For this WHERE, what index to create? WHERE subsidiary_id = 42 AND last_name LIKE '%INA%' Is (subsidiary_id) enough or should it be (subsidiary_id, last_name)? use-the-index-luke.com/sql/clustering…


I think "LIKE" doesn't use indexes. Because of this index for subsidiary_id is enough.


Well, then read the article to see that it does make a big difference. use-the-index-luke.com/sql/clustering…


I suspect "it depends". Is subsidiary_id unique? No need for more Is this heavily used? Maybe a covering index clustered on subsidiary_id But for basic usage (subsidiary_id, UPPER(last_name)) should suffice.


btree index on subsidiary_id and gin trigram index on last_name. Use postgres. With this it can use a bitmap OR utilizing both indexes. Depends on data distribution and uniqueness.


United States Trends
Loading...

Something went wrong.


Something went wrong.