Jump to content
MakeWebGames

How man queries are too many?


Recommended Posts

Lame, i mispelled in the title.

In the long run, how many queries on a game would be too many? Assuming the queries are optimized.

In an ajax game this number would most likely be increased, but in this day and age, what is really just too many? Basically when the cpu load is super high eh?

Edited by runthis
Link to comment
Share on other sites

there is not a straight answer to that, as it depends on the server, how it prioritizes the requests, the mysql settings (max connections, etc), the queries themselves and how they are constructed...

overall there is no way on answering to that without a full knowledge on the environment that the db's are running.

Link to comment
Share on other sites

To be honest it's not just your queries you should be worrying about as it's one part of it, you should time the execution of your scripts to see if they are slow for any reason. Of course there is no set bench mark for this (that I really follow anyway), but if something like a query or a loop is 90% of the load time it's then fairly easy to see that's what you should be looking into to. You can also have a read over this - http://makewebgames.io/showthread.php/38020-Code-profiling

Edited by Dominion
Link to comment
Share on other sites

  • 8 months later...

As many as you need is the correct amount.

An ajax game would not increase it at all. IF you had to query two tables for the something, there really should be some kind of join between the two thus making it just one query.

Edited by SirChick
Link to comment
Share on other sites

There isn't something such as too many queries.

A single query could be made up of five or ten sub-queries.

As long as you are using your DBMS wisely and optimize your queries as best possible, you can have millions within a single application.

Another thing, you do get to a point within your application where queries begins to be resource intensive.

That is the point where you rethink your current database design, and implement either a query cache, use DBMS replication servers or implement a load balancing scheme.

I'd say if your query executes in less than a second on average, you're doing quite all right.

(Note: this depends on many factors, but for un-indexed tables an average of 2.5s on complex queries is completely normal)

Link to comment
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...