PDA

View Full Version : Query tracking


InfiniteWebby
08-10-2003, 06:18 AM
I currently have 38 queries on my index and 50 on my showthread 0_0, Ive gone through the files (index.php/showthread.php/global.php) and cannot seem to find where they are comming from :( I was wondering if there is like a way to track the executed queries as the page is processed so i know exactly what is being run and what I might be able to remove.

Board url (http://www.infinite-forums.com)

There are plenty of hacks installed, but still shouldnt have that many queries, i dont think so anyway.

Erwin
08-10-2003, 07:59 AM
In config.php, add

$debug = 1;

to the bottom.

Then add

&explain=1

to the end of any URL you want to check.

Brad
08-10-2003, 09:11 PM
Just remember when debug is on it poses a security risk, so dont leave it on after you are done checking the pages.

DiscussAnything
08-11-2003, 01:08 AM
Cool trick. I've been struggling with a very slow index for a while, and now i know why:

Query: SELECT count(*) AS posts FROM post WHERE dateline > '1060567366'
Time before: 1.0531469583511
Time after: 18.15744304657


And 18 seconds is fast, it's sunday night now. During the week it's even slower. Is this the query that gets the total posts? The one that does the threads and users is fast though. Is there anything I can do to speed this up?

Brad
08-11-2003, 01:45 AM
That query is from a installed hack, number of posts scence last visit I belive. I would recomend removing it or adding a index to the post table to speed it up.

BTW the query that gets total posts reads as:

SELECT COUNT(*) AS posts FROM post

DiscussAnything
08-11-2003, 02:19 AM
I'd rather not remove it, but how do I add an index to the post table?

Brad
08-11-2003, 09:07 AM
run this query:

ALTER TABLE post ADD INDEX(dateline) ;

DiscussAnything
08-11-2003, 12:09 PM
Thanks brad, I'll try that :)



edit: awesome, it now loads in under a second. Thanks man!

Brad
08-11-2003, 12:34 PM
No problem, Just make sure that index isent taking up to much space, if it is its time to remove the hack. :)