Reply
A limit to mySQL queries
Old 11-30-2007, 07:25 PM A limit to mySQL queries
Average Talker

Posts: 20
Name: Shane
Is there a limit to how many queries I should be making? I am grabbing information from a half a dozen tables per page. I am also doing multiple lookups with each table. Like I look up a users information for the control panel. I then look up the newest user. Then another table with the poll information. That is just the left navigation. The right navigation has links that are looked up, recently updated pages, shout box information. The content is from a table. The header stuff is from a table. I don't know of anyway of really cutting down on the tables. I can't think of any way of megring any of the tables. Should I be worried about the number? Because I can only guess it is going to go up as I add more and more features to my site. It is running smoothly at the moment but the current features are only being beta tested by a small group. I'm afraid I will slow the site down or cause errors when I release the new features to everyone. It is all in one database so only one connection to that is made.

What are your thoughts? Leave it? Cut some?
Demexii is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 11-30-2007, 07:28 PM Re: A limit to mySQL queries
joder's Avatar
Flipotron

Posts: 6,443
Name: James
Location: In the ocean.
Are you sure you need all the information you are putting in the database in there?

I guess it's too much when your page load time suffers. Personally, I wouldn't do too much on one page.
joder is offline
Reply With Quote
View Public Profile
 
Old 12-01-2007, 11:59 PM Re: A limit to mySQL queries
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,024
Name: Forrest Croce
Location: Seattle, WA
Too much is when page generation time gets sluggish, like Joder said, or when you're gathering information you don't need.

If optimal performance is your goal, then there isn't a limit to the number of queries you perform. There's a limit, but it's how long your users will wait; more users at the same time gives you much less leeway. But the # of sql executions contributes to slowness less than other things you're able to control. You could put all of your information together in one huge table, and then write a single query, select * from mytable, and bring the system to its knees. You could run 25 finely tuned queries that pull back as few columns and rows as possible, that exploit indexes, and leave the formatting to the web server, and be fine. Two things come to mind:

If you query some info about the current user each time they request a page, for your navigation, this is a great candidate for caching. Put the information you need for your page in a session variable, ideally after formatting it. Update the cache when the user makes a change in their control panel.

If you're worried that moving out of beta into production will break the system, you should load test it.
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Reply     « Reply to A limit to mySQL queries
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com | Text Link Brokers 


   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11563 seconds with 12 queries