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
- 1. South Carolina 27.1K posts
- 2. Texas A&M 25.7K posts
- 3. Shane Beamer 3,578 posts
- 4. Sellers 13.6K posts
- 5. Michigan 43.4K posts
- 6. Northwestern 7,084 posts
- 7. Marcel Reed 4,457 posts
- 8. Ty Simpson 1,399 posts
- 9. #GoBlue 3,737 posts
- 10. Heisman 6,649 posts
- 11. Sherrone Moore N/A
- 12. Underwood 3,848 posts
- 13. College Station 2,901 posts
- 14. Nyck Harbor 3,200 posts
- 15. Semaj Morgan N/A
- 16. Andrew Marsh N/A
- 17. Elko 4,859 posts
- 18. #GigEm 2,056 posts
- 19. TAMU 6,921 posts
- 20. Jakobe Thomas N/A
Something went wrong.
Something went wrong.