Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Recordset Strategies


jatar_k - 9:08 pm on Sep 26, 2003 (gmt 0)


It always depends on what is being done with the data.

Why do multiple queries if one will suffice. As I loop through the rows reading them into an array why not just sort them into multiple arrays right away?

Multiple db queries just because its easier is pretty much a waste of resources. One complex query can usually get all of the data you need on any given page.

At some point the query will start hogging process and then you need to either rework the query or split it but every case is unique.

I have cases where the queries can be written as one but the processing power needed is ridiculous. These pages ended up having between 2 and 7 queries each and is much faster.

As I said each case needs to be assessed individually. There are exceptions to every rule but....

less queries == faster

thats the rule ;)


Thread source:: http://www.webmasterworld.com/php/1788.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com