4 ms·
Un-indexed queries are not inherently evil... sometimes they are faster than using/maintaining an index. Queries are all about context; how big of a data set,
by nettdata 17y ago
Un-indexed queries are not inherently evil... sometimes they are faster than using/maintaining an index.
Queries are all about context; how big of a data set, how much/fast is that data set changing, how often is the query being made, etc.
I've seen some cases where a single table had a crap-load of indexes, one specifically for each query that was being performed. The overhead of maintaining all of those indexes was killing performance.
I find the most effective query tuning is a result of having realistic stress/load testing combined with internal analytics from the database (EXPLAIN or EXPLAIN PLAN). This points out the low hanging fruit, which you can optimize using various methods such as indexes, materialized views, and in some cases, re-arranging the data model to better suit your queries.
It also gives you a better idea of which queries are being hit the most, and which ones it makes sense to spend your time tuning.