1

Can the following query be optimized ?

DELETE FROM COLOR_TAGS 
WHERE COLOR_PROJECTID = $id 
AND NoteID IN(
SELECT ID FROM note_note 
WHERE BibID=$bid AND isdel=0);
2

1 Answer 1

4

Add composite indexes to your tables:

On COLOR_TAGS, index (COLOR_PROJECTID, NoteID)

On note_note, index (isdel, BibID, ID).

Not the answer you're looking for? Browse other questions tagged or ask your own question.