aarondwi.github.io

View the Project on GitHub

Typical DB Performance Problems

  1. Bad Design (not materialized enough, not normalized enough, etc)
  2. Read lots first before filtering (either cause using view, not selective enough index, etc)
  3. Chatty application, i.e. looped query on client side, not at once
  4. Bad config (too small work_mem, innodb_buffer_pool_size, etc)
  5. Duplicate parent table row fetched (for 1-to-many relation, usually either caused by unneeded left join generated by ORM, or no default filtering, e.g. on order_date or equiv)
  6. Too many open connections causing lots of context switches
  7. Resouce not sufficient (CPU, Disk IOPS, Memory, etc)
  8. Query Planner’s poor decision (especially for PostgreSQL)
  9. No index used (either not defined, or wrong type)