List:General Discussion« Previous MessageNext Message »
From:supr_star Date:September 27 2011 12:32pm
Subject:query efficiency
View as plain text  
Here's a simple query:

select name,status,min(dt), max(dt),count(*)
from mytable
group by name

I need an efficient way to get this data, along with the status of the row with the
max(dt).  'status' is not in the group by, so I get apparently random statuses.
 Is there any way to do this without a table join?  Or I guess the real
question is:  What is the most efficient way of accomplishing this?  The table
is huge, 25M rows or so, but I can create any indexes.
Thread
query efficiencysupr_star27 Sep
  • Re: query efficiencyhsv27 Sep