PHP & MySQL: Good/efficient of showing statistics from thousands of rows on each page load : <p>I know this is the wrong way to go about it, but I have a database filled with stats about vehicles that are imported from excel files.</p>

<p>For each vehicle(about 100 currently, updated each three days) I have from 500 to 2000 rows of data which is used to build graphs regarding fuel consumption, distance driven etc..
This is fairly simple and it takes from 1 to 3 seconds to load, but I also need the total stats and compare it against each car.</p>

<p>So if I build the graph for car id 1, I want to see the difference between its fuel consumption and the global fuel consumption (of all existing cars).</p>

<p>Is there a way of doing this without querying not only the single car but also all cars on each page load ?</p>

<p>Thank you</p>
