java - READ COMMITTED lock wait timeout exceeded -


i have 1 question regarding transaction isolation level , locking in mysql.

i have 1 query keeps getting lock timeout error:

java.sql.sqlexception: lock wait timeout exceeded; try restarting transaction 

the queries try delete records specific date_id. btw, date_id indexed well. of times, there no records match, i.e. delete nothing.

after investigation, found may caused culprit long-running query, range select on same table. however, confused me both transaction run @ isolation level of "read committed". have no clue why lock needed , why timeout (especially consider there no matching record delete)

thank in advance!

the transaction isolation "read committed" contract: database promises read committed data , keep not-yet-committed data out of transaction. lock timeout error runtime-error: database tries update data cannot find moment (see "innodb_lock_wait_timeout" mentioned here in mysql reference manual). if there no data delete, database needs find moment in time assert that.

the transaction isolation "read committed" improves database's chances of finding moment update data (see here example), cannot prevent other queries/transactions locking entire table ("full table scan" culprit query does).

some more searching show possible solution delete problem.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -