Jump to content

num sql queries in page load


icedogas
 Share

Recommended Posts

Hello, thx for processwire and answer my question -

In wordpress was code

<?php
    echo '<center>'.get_num_queries().' queries ';
    timer_stop(1);
    echo ' second</center>';
?>

Wordpress shows how many sql queries makes engine(include cache or without cache) -

processwire have solution(code) like this?

Link to comment
Share on other sites

Hi Icedogas,

Welcome to PW and the forums.

If you switched debug on in your /site/config.php/, you would see the queries. Please note debug should only be turned on in dev/testing installs and not on your live/production server. 

Find this line in /site/config.php

$config->debug = false;  

and change it to 

$config->debug = true;  

Now in the Admin, you will see your queries (scroll down to the bottom). Note, this is only for the Admin. For frontend, you will have to do it differently using PHP code...

Link to comment
Share on other sites

I think Soma makes a good point with his last sentence - many well-crafted queries can work far quicker than one cumbersome query.

Plus the technology has moved on so much in recent years that your server shouldn't really strain under lots of queries.

Also, there are many caching options for ProcessWire to cut some of those out (MarkupCache for select lists etc, ProCache to serve a static version of your site and other solutions as well).

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...