简体   繁体   中英

Optimize Table or MySQL Settings for Update/Inner-Join a large table

This is related to a question I recently posted:

Efficient way to flag a record with min field value and common fieldX value in mysql

but similar errors are occurring on other queries that previously worked such as:

Update TableA as T1
Inner Join TableA as T2  
on T1.Field1=T2.FIeld1and T1.Field2 is not NULL
set T2.GroupFlag=T1.GroupFlag

All of a sudden, I am getting:

ERROR 1206 (HY000): The total number of locks exceeds the lock table size

I have run this before several times on this same table and it worked, so clearly the query is OK.

I know this question is sort of vague, but I'm not sure how else to ask it. Is there something in MySQL settings that I should check? We did recently restore a backup of the database to a new (this) server, but the only difference, as far as I know, is that we doubled the size of the server to give us room to work with.

UPDATE:

I did find this:

https://major.io/2010/02/16/mysql-the-total-number-of-locks-exceeds-the-lock-table-size-2/

which basically states that my innodb_buffer_pool is too small. I checked and our new server, though larger, never had the old settings of 2GB migrated and we only have 128MB.

so I will ask SysAdmin/DevOps to try this and report back to this question if it solves the issue (vs just removing the question since perhaps it will help someone else eventually).

Ok so answer to the question was Mysql settings. Apparently when we migrated servers DevOps/SysAdmin did migrate settings but didn't restart server as I jumped right into query-mode. We restarted last night and things worked swimmingly.

The issue was that innodb_buffer_pool was set to 128MB by default and our custom settings had it at 2GB.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM