Speedy Summary
Think about the big picture first
- Partitioning, choice of tools etc
Study and tune the access plans for your statements
- Teach your database about any uneven key distributions
Use placeholders - where supported
- Especially for any statements that vary and will be executed often
Replace do() in a loop with prepare() and execute()
Usually… sometimes queries using placeholders are slower!
- Because access plan has to be more general (try using hints in this situation)
Sling less data for faster fetching
Other important things to consider…
- hardware, operating system, and database configuration tuning