Re:Speeding up SQL queries by orders of magnitude using UNION
by epr on Sunday March 21, 2021 @11:34AM
(#26531187)
No, its pretty clear from reading his entire response that he understands exactly what sargable means. "just use indexes properly" is pretty ambiguous, but the rest of his comment provides context. It doesn't make much sense to me to be indexing on fn(x) for predicates unless an alternative sargable predicate is too complex or not possible, but that doesn't mean that it's never the best solution.
[ Parent
| on HN ]
Re:Speeding up SQL queries by orders of magnitude using UNION
by candu on Monday March 22, 2021 @09:18AM
(#26540356)
> unless an alternative sargable predicate is too complex or not possible...
As you note, functional indexes can sometimes be the best solution - some common examples: when working with different geospatial projections in PostGIS; when building a full-text index using `to_tsvector`. For anyone who works with relational databases that support this, definitely a good tool to have in your toolkit!