DELETE FROM table WHERE row_id IN ( SELECT ref_id IN ref_table WHERE a_col = '..' )I discovered the reason for slowness: IN clause run ineffective with non indexed items So here is a solution:
CREATE TABLE tmp_ref AS SELECT ref_id IN ref_table WHERE a_col = '..'; DELETE FROM table WHERE row_id IN (SELECT tmp_ref IN tmp_ref); DROP TABLE tmp_ref;
No comments:
Post a Comment
New comment