If I have a database driven website with hundreds of pages, and someday if my users starts complaining that the website is very slow, how do I know the bottleneck?
Is there anyway in mysql to know what query is causing slowness?
There is the slow query log: http://dev.mysql.com/doc/refman/5.5/en/slow-query-log.html
but afaik that doesn't work with prepared statements. Does each script open it's own database connection or are you passing a single database connection around all the scripts that need it?