Hamish Burke | 2025-06-16

Related to: #databases


heuristics

  1. prefer uses indexes in general (especially for selection)
  2. prioritze selections that narrow down the scope massively
  3. join order should start with small tables
  4. favor inner joins over cross joins to avoid excessive row combinations
  5. minimise use of cross joins (Cartesian Product)
  6. compare subqueries vs joins
  7. apply limit/offset early
  8. avoid full table scans
  9. use indexes so sorting is optimised (so data is already sorted)
  10. leverage parallel processing
  11. evaluate query plans based on Cost based query optimisation
  12. use indexes on join columns
  13. eliminate redundant operations
  14. use indexing or pre-aggregation for groupby/having
  15. consider splitting queries with OR into separate SELECT statements and use union