mysql_use_result vs. prepared statement
Posted by: Julien Coloos
Date: November 09, 2012 10:06AM

In order to minimize memory consumption on the client side, one can use mysql_query/mysql_real_query and mysql_use_result, or use a prepared statement with cursor.

However the documentation (http://dev.mysql.com/doc/refman/5.6/en/mysql-use-result.html) warns that:
Quote

On the other hand, you shouldn't 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.

Is this always true, in all versions of MySQL server ?
I tried fetching ~1 million entries from a 5.5 server at a really slow pace (1 per second), and was still able to update the entries in the table while doing so. Maybe the table (or parts of it only ?) would be locked in certain conditions ?
If so, do prepared statements with cursor prevent this kind of locking ? or does the locking (under similar conditions maybe) also apply with prepared statements ?

Options: ReplyQuote


Subject
Views
Written By
Posted
mysql_use_result vs. prepared statement
2949
November 09, 2012 10:06AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.