database - MySQL is slow when delete records in large table -


i have query takes long time run. table around 4 million rows.

delete table value_was null or value_was <= value_now; 

i'm hoping create index (value_was, value_now) like

delete table  id1 in (select id1 table value_was null)  or id2 in (select id2 table value_was <= value_now); 

this table doesn't have primary key. has 2 composite keys. , guess cannot use same table in subquery, how improve performance of first query?

thanks suggestion appreciated.

updated: db innodb

due way data stored, internal linked list, innodb tables inherently slow @ huge delete operations. changing storage type myisam should make operation awful lot faster - i've seen 100x improvements in similar situations.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -