Re: Problem query - Mailing list pgsql-performance

From Kevin Grittner
Subject Re: Problem query
Date
Msg-id 4DE74E06020000250003DFE6@gw.wicourts.gov
Whole thread Raw
In response to Re: Problem query  (CS DBA <cs_dba@consistentstate.com>)
Responses Re: Problem query
List pgsql-performance
CS DBA <cs_dba@consistentstate.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

pgsql-performance by date:

Previous
From: Jenish
Date:
Subject: Re: Strange behavior of child table.
Next
From: "Kevin Grittner"
Date:
Subject: Re: Understanding Hash Join performance