Website Slow due to database


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:

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?