i have some delete queries to run against some pretty huge table (~100 GB), and i want to optimize them as much as possible:
delete from table1 where column1 < date_sub(now(), interval 100 hour);
column1 is a datetime column, i assume making an index for this column will speed up the deletions. besides that, anything i can do here? will using the date_sub() function slow down the query? should i calculate that value before running the query?
delete from table2 where column2 = x;
column2 is the primary key for table2, so it's already an index according to the mysql documentation. my question is: the index kind is "PRIMARY", is that same as the "INDEX"? do i have to make another index of the kind "INDEX" for speeding up?
delete from table3 where column3 = y;
table3 has a compound primary key, which is column3 and column4. so i have an primary key index, but since the delete query doesn't use column4, should i make a separate index just for column3? or the combined primary key would do it?
i guess these are pretty basic questions, but i couldn't find a definite answer specific to my situation, so any help would be appreciated!