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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
mysql-5.7 × 1011mysql × 778
innodb × 113
performance × 69
replication × 58
mysql-5.6 × 47
query-performance × 41
mysqldump × 38
index × 37
optimization × 33
mysql-8.0 × 33
mysql-5.5 × 32
amazon-rds × 30
ubuntu × 22
master-slave-replication × 21
aws-aurora × 20
query × 19
join × 18
database-design × 16
partitioning × 16
json × 16
percona-server × 16
memory × 15
mysql-workbench × 15
percona × 15