简体   繁体   中英

Mysql very slow Join Performance

I'm hoping someone can advise, but I'm experiencing very long processing times around the following join statement, and was hoping to get some suggestions on improving performance. Both tables have millions of records in each, and I have column indexes on, but it's still taking over 70 hours to run this join.

update <table x> a
left join <table y> b
on a.PARENT_ID=b.ID and a.LOAD_ID=b.LOADID                    
set a.DATETIME=str_to_date(b.`DateTime`, '%m/%d/%Y %H:%i:%s'), a.ROOM_ID=b.ConID, a.STATUS='Exited'
where a.PARENT_ID=b.ID and a.LOAD_ID=b.LOADID and a.PROCESSING_FLAG = 0 and b.PROCESSING_FLAG = 0

So table x has 66m records, and table y has 44m, but using the PROCESSING_FLAG it won't be joining all 66m records to 44m records, only a subset. I have column indexes on a.Parent_Id, b.ID, a.Load_ID, b.LoadID, a.Room_ID, b.ConID, a.Processing_Flag, and b.Processing_Flag. Both tables use MYISAM and I'm using MySQL 5.6.17.

Is there anyhting I can do to improve the performance of this statement? I was thinking of increasing the key buffer perhaps to 6G as a first step.

MYISAM is very best to Select operation. if your database is very much heavy with good user . Update operation will take time.

try to make join with index column. Join will perform good.

communicate with your mysql server admin tell him/her to increase join_buffer_size

join_buffer_size server variable to responsible allocate memory for joins that not perform join with index column

I hope this will help you.

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