quicker performace wise - SQL or PHP

Associate
Joined
31 Aug 2011
Posts
123
Hi guys,

I am having a performance issue with a site and am trying to find the best approach to optimize it.

There is a large table of data that loads on the page the size of it depends on the day. When the data size is large the page can take up to 5 - 10 seconds to load which is not great however this really only happens during peak times and i really want to improve this.

At the moment i have a large JOIN query pulling all the data into a huge rectangular array and then I process it all via PHP loops.

I am wondering if it would be quicker to have smaller loops but more SQL Queries that return smaller sections of data.

For Example:

at the moment an array gets returned that has 3 layers and many many categories which ends up returning a lot of data

Category
--|_Items
-----|_Detals

Php then loops through it all breaking it down into a visible table.

What I want to know is:

Will it be a lot faster if I run a query for each category and have more queries but smaller loops in PHP?
 
Back
Top Bottom