Re: Problem query
От | CS DBA |
---|---|
Тема | Re: Problem query |
Дата | |
Msg-id | 4DE6BD11.6060603@consistentstate.com обсуждение исходный текст |
Ответ на | Re: Problem query ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>) |
Ответы |
Re: Problem query
Re: Problem query |
Список | pgsql-performance |
On 06/01/2011 03:38 PM, Kevin Grittner wrote: > CS DBA<cs_dba@consistentstate.com> wrote: > >> The app wants to run a query like this: >> >> select count(pri_num) from max_xtrv_st_t >> where pri_num in (select max(pri_num) from max_xtrv_st_t where 1=1 >> group by tds_cx_ind, cxs_ind_2) > > Why not something simpler? There are a number of possibilities, and > I don't claim this one is necessarily best (or even error free), but > how about something like?: > > select count(*) from > (select distinct max(pri_num) > from max_xtrv_st_t > group by tds_cx_ind, cxs_ind_2) x > > -Kevin I've tried a number of alternates, each one wants to do a seq scan of the table (including your suggestion above). -- --------------------------------------------- Kevin Kempter - Constent State A PostgreSQL Professional Services Company www.consistentstate.com ---------------------------------------------
В списке pgsql-performance по дате отправления: