PDA

View Full Version : finding the # of queries per hour


pk698
4-14-05, 08:53 PM
Where can I find out how many queries I'm using per hour?

B&T
4-14-05, 09:45 PM
You cannot. From a historical perspective you can look at your logs, but they are missing many entries (many threads on that).

You can look in OPS at the http usage tab a look at the graph for daily rough numbers.

mitchind
4-14-05, 10:09 PM
Where can I find out how many queries I'm using per hour?

How seriously do you want to know?

If you know a little bit of PHP you can use Pig's query counter script..

http://webhead.cc/main.php?inv=71

pk698
4-14-05, 10:41 PM
Just wanted to monitor my queries so I can see how close I am to reaching the limit set by PW.

riskynil
4-14-05, 11:40 PM
If you know a little bit of PHP you can use Pig's query counter script..

Yeah, I've done that. The one thing I don't really like about it, however, is that is doesn't really tell you where you're using all your queries. If you're getting high counts, it can be a challenge trying to figure out where to focus your energies on lowering them.

I eventually created a database object that all queries are sent to. The object counts how many times the query() function is called on a given page, and if I'm logged into the website, it'll display the number of queries generated on that page. (It only displays this when I'm logged in, however, not if anyone else is using it.) So when I surf the site, I can see which pages tend to be query hogs.

It's also easy for me to check how often a given page is loaded which, when multipled by the typical number of queries used to generate that page, gives me a good estimate for the total number of queries that page is generating per day, week, or whatever timeframe I choose. (After all, one page that causes 1,000 queries but only gets called once a week probably shouldn't be the focus of your efforts if another page that's called 10,000 times a week uses three queries per page.)

I can provide some of the code I use for it if you're really interested, but I just thought I'd throw out the thought if you're interested in other ways of doing essentially the same thing. I can even roughly estimate the total number of qureries my site uses by multiplying the total number of pages viewed in a day by the typical number of queries used to generate a page. In my case, I'm averaging *about* 7,000 pages per day with about 4 queries per page (always between 1 and 8 queries per page, but on average, 4) giving me about 28,000 queries per day that I'm using. Seeing as that's less than what's allowed for an hour, I think it's pretty safe to assume I'm well on the good side of PowWeb's quota. =)

-- Ryan