locate data in tables • Write operations update the indexes • Mostly B-tree. Bitmap, Gin, Gist • Db chooses whether to use index, or which one • Cardinality matters
useless • Filtering can help. • Join algorithm can change based on the table sizes: Nested or Hash (or Sort-Merge) • Index access can itself be inefficient • ORDER BY clause has extra cost. Can be reduced with indexes • GROUP BY improves with indexing • Partial indexes are available
a fairly basic EXPLAIN • Watch out for: Type column – 'Using index', 'eq_ref', 'const', 'primary' are fine – 'ref', 'range' may be okay – 'ALL' is not fine • 'Rows' column is also a good indicator