Bug #78656 mysql_use_result needs clarification
Submitted: 1 Oct 2015 1:56 Modified: 14 Oct 2015 22:07
Reporter: Jervin R Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[1 Oct 2015 1:56] Jervin R
Description:
Quoting the manual

""""
On the other hand, you should not use mysql_use_result() if you are doing a lot of processing for each row on the client side, or if the output is sent to a screen on which the user may type a ^S (stop scroll). This ties up the server and prevent other threads from updating any tables from which the data is being fetched. 
""""

I think this is an overarching statement, though I agree is quite scary for a lot of people too. 

How to repeat:
See documentation https://dev.mysql.com/doc/refman/5.6/en/mysql-use-result.html

Suggested fix:
Perhaps we can add something like:

If you are doing non locking SELECT (i.e. not in SERIALIZABLE transaction isolation) then things are usually fine. However, if you do things like SELECT FOR UPDATE, then this statement would apply as since as long as the results are buffered on the server, the resulting rows are locked and can definitely cause issues.
[1 Oct 2015 7:37] MySQL Verification Team
Hello Jervin,

Thank you for the report.

Thanks,
Umesh
[6 Oct 2015 2:13] Jervin R
A little modification:

If you are doing non locking SELECT (i.e. not in SERIALIZABLE transaction isolation) then things are usually fine. However, if you do things like SELECT FOR UPDATE or LOCK IN SHARE MODE within a transaction, then this statement would apply as since as long as the transaction is ACTIVE, the resulting rows are locked and can definitely cause issues.
[14 Oct 2015 22:07] Daniel Price
Posted by developer:
 
The text has been revised as follows:

"On the other hand, you should not use mysql_use_result() *for locking reads* if you are doing a
lot of processing for each row on the client side, or if the output is sent
to a screen on which the user may type a ^S (stop scroll)."

Thank you for the bug report.