Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



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

Posts: 20
Name: Shane
Trades: 0
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
 
 
Register now for full access!
Old 11-30-2007, 07:28 PM Re: A limit to mySQL queries
joder's Avatar
Flipotron

Posts: 6,442
Name: James
Location: In the ocean.
Trades: 0
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,023
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
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.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Reply     « Reply to A limit to mySQL queries
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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





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



Page generated in 0.13446 seconds with 12 queries