arcticsnpr 0 Report post Posted May 23, 2006 I know that querying the database multiple times in a script is bad, because it uses bandwidth. But what if you have practically unlimited? If you have too, is it ok to have many queries in one script? Share this post Link to post Share on other sites
Spectre 0 Report post Posted May 23, 2006 Hmm... I think you're a little confused. Assuming your MySQL host and web host share the one server (or at least, are on the one local network), it won't use any bandwidth no matter how many queries you execute, because the traffic never leaves the network and therefore is not counted. It's not until you start sending data to a user from your server that it will start to eat away at the bandwidth. You can have as many queries as you like in a script. The only real limitation you may face is speed - if you attempt to execute a large number of complex SQL queries in one go, the server may take a while to process them and begin to slow down, particularly if you have very large databases. This may present something of a problem if your script carries out a lot of queries. The only related problem I can think of is the number of connections a single MySQL host can handle at any one time. This is particularly a problem on shared webhosts that host thousands and thousands of different sites, all of which could be attempting to access a single MySQL host at any given time (some long-term members of Xisto may have seen this issue raised before). Poor coding practises can also lead to trouble, such as failing to clear query memory, close connections, etc. Share this post Link to post Share on other sites