Hacker News new | ask | show | jobs
by mdpye 1106 days ago
I haven't checked if this works in mysql, but in postgres I would certainly reach for an index on the computed values, which it supports.

Index the thing you're querying on...

2 comments

Totally agree! From the article:

> The optimal indexing strategy always depends on the application, but in general, it's best to have indexes on the conditions you are frequently querying against. [...] This makes redundant conditions useful for queries that are only sometimes run or where indexes can't be easily added to the main conditions.

MySQL 8+ also supports functional indexes