- Bad Design (not materialized enough, not normalized enough, etc)
- Read lots first before filtering (either cause using view, not selective enough index, etc)
- Chatty application, i.e. looped query on client side, not at once
- Bad config (too small
work_mem
, innodb_buffer_pool_size
, etc)
- 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)
- Too many open connections causing lots of context switches
- Resouce not sufficient (CPU, Disk IOPS, Memory, etc)
- Query Planner’s poor decision (especially for PostgreSQL)
- No index used (either not defined, or wrong type)