| From: | "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> |
|---|---|
| To: | <sthomas(at)peak6(dot)com>,"Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> |
| Cc: | "CS DBA" <cs_dba(at)consistentstate(dot)com>, <pgsql-performance(at)postgresql(dot)org> |
| Subject: | Re: Problem query |
| Date: | 2011-06-02 16:15:50 |
| Message-ID: | 4DE770E6020000250003E01C@gw.wicourts.gov |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-performance |
"Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> wrote:
> Shaun Thomas <sthomas(at)peak6(dot)com> wrote:
>> What you really want is this:
>>
>> SELECT count(1) FROM (
>> SELECT DISTINCT tds_cx_ind, cxs_ind_2
>> FROM max_xtrv_st_t
>> );
>
> Or maybe:
>
> SELECT count(DISTINCT (tds_cx_ind, cxs_ind_2)) FROM max_xtrv_st_t;
Or maybe not. I tried various forms of the query against "real"
tables here, and Shaun's format was ten times as fast as my last
suggestion and 12% faster than my first suggestion.
They all gave the same result, of course, and they all used a seq
scan..
-Kevin
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Shaun Thomas | 2011-06-02 17:31:58 | Re: Problem query |
| Previous Message | Kevin Grittner | 2011-06-02 15:41:45 | Re: Problem query |