Hello everyone, I am trying to speed up my drupal website and I spent last 2 hours trying to find out how to get number of sql queries that were executed on current page, could you help?

Only useful thing I found is the $queries global variable which should contain number of queries, but var_dump($queries) prints NULL in my case :/.

I'm using Drupal 6.1. Thanks for any idea!

Comments

styro’s picture

it has all that kind of stuff (and much more) included

--
Anton
New to Drupal? | Troubleshooting FAQ
Example knowledge base built with Drupal

keff’s picture

Hi, if it has the right stuff, it is very well hidden (and besides, Devel manages to crash my 3 months old instalation of XAMPP :/). And I certainly don't want it running all the time (Devel seems to be quite resource-hungry), i would just like one integer - number of queries... Any alternative, please?

vm’s picture

very well hidden ? did you enable the devel blocks ???

as far as crashing XAMPP, you could be using an outdated version of Zend Optimizer. There is a note about this on the project page.
and tsk tsk for not reporting the bugs if you've found any.

Lastly, you don't have to run devel all the time, you can disbale it when its not needed.

I don't have an alternative method, because I use devel exclusively.
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

keff’s picture

I am very sorry, but I still can't find the number of queries... :/
I enabled devel module, got rid of zend_optimizer (which crashed - thanks for the tip!), and enabled the devel block, but no matter which of its functions I use, I can't find query count:

Empty cache - nope
Enable Theme developer - lots of useful info but not query count
Function reference - nope
Hook_elements() - nope
Node_access summary - nope
PHPinfo() - nope
Reinstall modules - I don't want to do it
Reset menus - I don't want to do it
Session viewer - nope
Run cron - nope
Theme registry - nothing related to queries
Variable editor - nothing related to queries

Well, then I thought, maybe devel module adds some page statistics into the comments, so i looked into the source of generated page, but... no query count there.

PLEASE, don't tease me, where is it???

styro’s picture

The devel module settings allows you to enable an option to list queries, count queries, and highlight expensive queries, plus page generation time and memory usage etc.

--
Anton
New to Drupal? | Troubleshooting FAQ
Example knowledge base built with Drupal

modul’s picture

Umm, at the risk of stating the obvious: when you run the Devel module, it shows all queries below your actual page. It's a bit silly to ask, but did you scroll down far enough?

keff’s picture

Thanks - but it seems that something wrong is going on - I double checked that all caching is off, enabled all devel modules and put them into sidebar, even tried switching the site to garland (in case I forgot to put some block container in my theme), but nothing happens - Devel works, and shows stuff, but doesn't add anything into footer or any other part of page.

keff’s picture

OMG!! Mea culpa! Sorry everyone - I finally noticed a new item in admin menu - Devel Settings :O And yes, everything is settable there, including query logging.
Once again - thank you for your time!