Nile Posted July 6, 2011 Share Posted July 6, 2011 Hey, simple question here (I think): I'm experimenting with jquery ajax to perform sql queries through php for a little game. I need these to be fast, and it's executing quite a few queries. Having said that, is it faster to send all the data to one file to perform all of these queries, or instead have mutliple php files all performing their own unique query. The benefit I can see in the latter option is that the queries would be asynchronous; however, it would require more connections to php files. Any feedback would be greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/241233-multiple-sql-queries/ Share on other sites More sharing options...
AyKay47 Posted July 6, 2011 Share Posted July 6, 2011 you can feed them to one file and still have them asynchronous..depends on how you are going about it. Quote Link to comment https://forums.phpfreaks.com/topic/241233-multiple-sql-queries/#findComment-1239136 Share on other sites More sharing options...
xyph Posted July 6, 2011 Share Posted July 6, 2011 It'll be easier on your server to build up a few seconds worth of queries and execute them within a single mysql connection. You'll lose out on responsiveness though. Your best bet is to code it so you have the option to poll up a few queries. Have it so if you set the time to 0, it executes them immediately, otherwise it waits x seconds to allow queries to build up. Quote Link to comment https://forums.phpfreaks.com/topic/241233-multiple-sql-queries/#findComment-1239174 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.