CS DBA <cs_dba(at)consistentstate(dot)com> wrote:
> On 06/01/2011 03:38 PM, Kevin Grittner wrote:
>> select count(*) from
>> (select distinct max(pri_num)
>> from max_xtrv_st_t
>> group by tds_cx_ind, cxs_ind_2) x
> I've tried a number of alternates, each one wants to do a seq scan
> of the table (including your suggestion above).
Is there some reason to believe that a sequential scan isn't the
fastest way to get the data? When generating summary data like
this, it often is faster than lots of random access. If you can
coerce it into a faster plan by turning off enable_seqscan on the
connection before running the query, then we can look at how you
might adjust your costing parameters to get better plans.
-Kevin