I would like to monitor the performance of an sql query that I have embedded within a template, it sits within a PHP block. What is the best way to get at this?
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
July 08, 2012 4:26am
Subscribe [3]#1 / Jul 08, 2012 4:26am
I would like to monitor the performance of an sql query that I have embedded within a template, it sits within a PHP block. What is the best way to get at this?
#2 / Jul 08, 2012 6:43am
1. As superadmin, you can see the results of the template profiler (if you turn on the template profiler). In the footer of that page, it will output the queries performed on that page and the time it took to complete.
2. You can also turn on the slow query log in MySQL (if your hosting environment supports it) and watch for execution times on queries that exceed the threshold you configure.
...
I hope to hear of others’ methods… but these are the two I use frequently
#3 / Jul 08, 2012 7:03am
Thank you will try this out
#4 / Jul 08, 2012 8:56am
I have turned on:
Display Output Profiler
Display Template debugging
When I select “view rendered template” nothing is being shown in terms of stats. My template contains no ee tags just a php block.
#5 / Jul 09, 2012 2:35pm
Hey jackiewales,
Thank you for posting your question here on the ExpressionEngine forums.
I am glad to see that Mark was able to point you to the dubugging.
Aside from this method, I am not aware of a way to track performance. The profiler should be spitting out times on the queries. When you visit the page directly in the browser, are you getting anything? It will be in the lower half of the template.
Just FYI, Debugging info.
To turn debugging on please go to your Control Panel and navigate to Admin->System Administration-> Output and Debugging. Please set the last two settings, which are “Display Output Profiler?” and “Display Template Debugging?”, to yes.
Thank you,
#6 / Jul 10, 2012 8:28am
hi Shane,
Yes those options are toggled on. I see the debug info at the base when the template is in code view but it does not show when I generate the template, it seems to be turned off?
thnx Jackie
config.php - $config[‘debug’] = “1”;
index.php - $debug = 0;
#7 / Jul 11, 2012 1:23pm
Hey jackiewales,
Go ahead and remove the debug settings from those files. Just leave them blank or remove them. Config files will always override what you set in the Control Panel. I like to keep stuff to the Control Panel so it’s more dynamic.
Cheers,
#8 / Jul 11, 2012 5:46pm
Hi Shane,
Have pruned! But am still not seeing template debug info?
addendum: Noticed this post: http://ellislab.com/forums/viewthread/206784/ This seems to be the problem as observed by John. When I generate from within the cp the www is not shown on the url, if I manually add the www the debug info is revealed! I would ideally like the debug info be shown on template generation, how can I get around this?
#9 / Jul 12, 2012 2:03pm
Hey jackiewales,
Hmmmm….. Are you using an .htaccess file? If so, are you being consistent with the use of www in there as well as in the Control Panel?
Thanks,