Hello
I'm in the process of creating a web site for a local car dealer.
On this site I have a table that outputs all the current inventory. Im using an AJAX call to a php page that pulls all the car data from the db then returns the result to my table. I want to be able to sort all of the data in this table with out page refresh. So if the user clicks on the column header "Year" the whole table will be sorted by that column. I know how to do this but my question is is it faster for the php page that is called via AJAX to make a query to the db then sort the data with a php sorting function OR is it faster to just make a new query each time and sort the data with MYSQL orderby.
The dataset returned from the db will always be the same. So i was thinking if i did the first way i could cache the db query and all i would do is sort it every time. The second way I always have to make a query but the sorting is already done.
So basically what is faster having mysql order my data or PHP.
When a column header is clicked I'm going to fade out the current data and fade back in the new sorted data. Because of this I want the data returned as fast as possible.
Thanks in advance for any help.