Forum Moderators: open

Message Too Old, No Replies

MySQL: Which is faster?

new query or working with exising selection?

         

mike73

9:57 am on Jun 11, 2007 (gmt 0)

10+ Year Member



I have a database-driven site that gets lots of traffic, so I need to streamline it as much as possible.

Here's the scenario:

I select 30 records from a table. Then I extract DATE columns from those records and put them in an array. After that, I need to retrieve one of those records again, but this time, I extract an additional TINYTEXT and 2 TEXT columns.

So my question is this:
What is the fastest way to get the last record? Is it faster to make a new query, or should I massage the existing selection?

coopster

4:07 am on Jun 14, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You'll have to run your own performance tests. I'm guessing 30 rows of TEXT columns could get a bit more memory-intensive, but then again, it depends on how much data is actually stored in the columns. Run it both ways and monitor it as the table grows.

mike73

6:24 pm on Jun 17, 2007 (gmt 0)

10+ Year Member



thanks

joelgreen

1:49 pm on Jun 18, 2007 (gmt 0)

10+ Year Member



Do you need those 30 records or you retrieve them only to find out the last one? Maybe you could tune the query to retrieve only needed record.