Re: Problem query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Kevin Grittner" <Kevin.Grittner@xxxxxxxxxxxx> wrote:
> Shaun Thomas <sthomas@xxxxxxxxx> 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

-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux