Summary (so far)
Think about the big picture first
Partitioning, choice of tools etc
Study and tune the access plans for your statements
Teach your database about your key distributions
Use placeholders
Especially for any statements that vary and will be executed often
Replace do() in a loop
with prepare() before the loop and execute() within it
Usually…
- some drivers don’t support placeholders
- sometimes queries using placeholders are slower
- because access plan has to be more general