3 ms·
Could you elaborate what you mean by "naive indexes"?
by pocket_cheese 4y ago
Could you elaborate what you mean by "naive indexes"?
- fabrice_d 4y agoIn general that means looking at the sql query plan for a slow query, and adding appropriate indexes when there are full table scans.
- ocimbote 4y agoI assume "naive" means "simple, basic" here. As in "index this column. Period".
- dgb23 4y agoNot GP. But you can often anticipate where indexes have to go for common queries. There might be some important colums like say a “status” or a “date”, which are fundamental to a lot of queries. Or you have colums X and Y being used frequently or importantly in where clauses together, then that’s a candidate for composite indexes. Stuff like that.
- hinkley 4y agoI think historically people had a lot of bad intuitions about how effective non-composite indexes are in databases. That if I have an index for A and an index for B I should be able to do A & B and get a quick answer. There's been a lot more educational material on composite indexes and in particular partial indexes and so I'm not sure if someone with 3 years' experience today can accurately judge a conversation talking about ten years ago.
- scotty79 4y agoIf some field is referenced in WHERE clause, add an index for it. If there are a few fields referenced in a single WHERE add a single index that includes all of them. If you have index that has a, b, c then it is as if you also had indexes a, b and a. If condition in WHERE is = put this field at the beginning of an index. If it's < (or similar) put it at the end. You'll get best results if you have none or only one < in your query.