Jump to content

how many queries are too many per page?


Recommended Posts

I completed the php calendar found here at phpfreaks
[url=http://www.phpfreaks.com/tutorials/83/0.php] http://www.phpfreaks.com/tutorials/83/0.php[/url]

After some modifications I turned it into an event calendar which stores in a mysql database. After much thinking I finally wrapped my head around how to find repeating events by using a start_date, end_date, and repeating interval.

I completed it, it works great, and then I got curious as to how many queries that calendar was pushing on each page load. I was shocked to see an average of 150 queries per page load!! I am running like 5 queries per day the calendar generates. So 31 days gives 155 queries.

Is this too many queries to have per page? I would like to reduce this, I will post my code if someone wants to help me tackle eliminating some of those queries.

Link to comment
Share on other sites

150 queries per page load! I think you need to optimize your database relationships and also do some real code changes. No page should ever have that many queries in a real time dynamic application. I have a banking application, (credit card, charge transfer agent) that has over 3 million process requests a day, and it runs 5 really complex queries and 4 other normal/simple queries, which to me is still to much. I also I have a forum running that is always very busy, (500+) user online all the time and it only uses 11 queries for the most intense operation, but most operations only use 7 to 9 queries per page.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.