2 votes
Accepted

how to properly index a varchar column that won't use LIKE

Given your query, I would add this index: ALTER TABLE pdf_packages ADD INDEX (private_reference_number, deleted_at); That matches the two conditions you have in your WHERE clause, so it should do the ...
user avatar
  • 9,248
1 vote

how to properly index a varchar column that won't use LIKE

(Focusing on the Title) LIKE is useful in testing VARCHARs. x LIKE 'abc' -- this turns in to x = 'abc' x LIKE 'abc%' -- will _probably_ use INDEX(x) x LIKE '%abc' -- cannot use INDEX(x) x = 123 ...
user avatar
  • 68.1k

Only top scored, non community-wiki answers of a minimum length are eligible