MySQL Forums
Forum List  »  Performance

Re: Which strategy is better to traverse a big table?
Posted by: yanlin peng
Date: February 25, 2009 02:25PM

Thanks to khan and James. Starting from your comments, I investigate
mysql C API and found that mysql_store_result (that I used in my codes)
does not deliver results piecemeal, instead it delivers the whole results
at once.

Another function mysql_use_result(), however, can handle big results
more efficiently. It initiates a row-by-row result set retrieval. In my
case, I'll select all qualified rows and use this function to process
the result row by row.

NOTE: mysql_use_result() may have deadlock problem, as mentioned in the manual:
"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. "

Thanks again for your help. I found this forum is very active and helpful!

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Which strategy is better to traverse a big table?
1910
February 25, 2009 02:25PM


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.