Quantcast
Channel: MySQL Forums - InnoDB
Viewing all articles
Browse latest Browse all 1956

Do SELECT statements create some kind of row/table lock? (4 replies)

$
0
0
I have encountered a situation in which it "appears" as if a SELECT is creating some kind of lock that blocks other sessions on a particular table. Here is the scenario.

I have a table with a large number of rows (more than 14 million) and 4 indexes. (Yes, I understand that this is not optimal for what should be a transaction-oriented system. I'll be dealing with that soon enough.) I am building a support table based on data in this large table. During that process, I use a correlated subquery to find data in this very large data and use it to update columns in my support table. Meanwhile, other sessions are inserting new rows into this very large table. When all this is going on, I can start up innotop and observe that the INSERT transactions are blocking and timing out. As soon as my UPDATE with the correlated subquery finishes, the blocking no longer seems to occur.

I thought I understood that SELECT statements (such as the one in the correlated subquery) would not produce any kind of blocking locks on the table, but this isn't consistent with what I'm witnessing.

Do I misunderstand the locking model? Or, is there some other possible explanation that I'm not thinking of?

Thanks,
Dave

Viewing all articles
Browse latest Browse all 1956

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>