MySQL Forums
Forum List  »  General

Multiple selects in a transaction?
Posted by: Ken Williams
Date: November 04, 2022 09:20AM

Hi, I have a question.

I need to check all the balances in set of tables at a point in time. But this operation could be lengthy (say 5 minutes) for it to do a bunch of selects, calculate some balances, and spit out a number. During this 5 minute span there will also be many inserts into these same tables that will effect the balances.

How do I handle this? I don't need to include the extra inserts during this operation. But I don't want to lock the tables and stop the inserts from happening either as the site still has to function properly while I do my operation.

If I wrap all my operation's selects in a transaction will that do all the selects at one point in time only leaving the tables unlocked for normal use? It's my lack of understanding that confuses me, I don't know what MySQL does.

I guess I need to lock without locking. Is that a thing?

Options: ReplyQuote

Written By
Multiple selects in a transaction?
November 04, 2022 09:20AM

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.