This post dedicated to Edwin DeSouza.
Un-tuned SQL or stored procedures often fail to scale as table volumes increase, inefficiency increases exponentially with size.
Tune SQL/stored procedures and then buy new hardware.
use EXPLAIN
to help optimize queries. Also use the
slow query log.
EXPLAIN EXTENDED
shows sql that was actually used —
ie, optimizer may rewrite query, so it’s a neat tool.
you can always give optimizer hints, but they’re not recommended
— keep checking them as your app grows —
STRAIGHT_JOIN
, FORCE INDEX
, USE
INDEX
, and one other one.
SHOW STATUS
gives you status variables.
innodb_buffer_pool_read_requests
and
innodb_data_read
will show how much data is being
read from the buffer pool vs. data.
Index isn’t always used, if more than 20% or …
[Read more]