What is happening under the hood to the selected data in a MySQL cursor?


I have a number of MySQL stored procedures that use a cursor to go through a select and then pass the results to other stored procedures one row at a time.

This can take a while to run, what is happening under the hood while the cursor is looping through? Is the select discarded and the results kept in memory or in a special temp table or something else?

The reason I ask is that I have had problems where between the start and the end data will get removed and then an insert will fail because of a foreign key relationship.

Why should this post be closed?


0 answers

Sign up to answer this question »