Re: [PERFORM] Distinct + Limit

2012-03-28 Thread Merlin Moncure
On Wed, Mar 28, 2012 at 9:13 AM, Tom Lane wrote: > Francois Deliege writes: >> I have the following table with millions of rows: > >> CREATE TABLE table1 >> ( >>   col1 text, >>   col2 text, >>   col3 text, >>   col4 text, >>   col5 text, >>   col6 text >> ) > >> select col1 from table1 group by

Re: [PERFORM] Distinct + Limit

2012-03-28 Thread Tom Lane
Francois Deliege writes: > I have the following table with millions of rows: > CREATE TABLE table1 > ( > col1 text, > col2 text, > col3 text, > col4 text, > col5 text, > col6 text > ) > select col1 from table1 group by col1 limit 1; > select distinct on (col1) col1 from table1 limit

Re: [PERFORM] Distinct + Limit

2012-03-27 Thread Ants Aasma
On Tue, Mar 27, 2012 at 11:54 PM, Francois Deliege wrote: > select col1 from table1 group by col1 limit 1; > select distinct on (col1) col1 from table1 limit 1; > > select col1 from table1 group by col1 limit 2; > select distinct on (col1) col1 from table1 limit 2; > > Performing any of these foll

[PERFORM] Distinct + Limit

2012-03-27 Thread Francois Deliege
Hi group, I have the following table with millions of rows CREATE TABLE table1 ( col1 text, col1 text, doc text ) select col1 from table1 group by col1 limit 2; select distinct on (col1) col1 from table1 limit 2; -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org

Re: [PERFORM] Distinct + Limit

2012-03-27 Thread Francois Deliege
Hi list, I have the following table with millions of rows: CREATE TABLE table1 ( col1 text, col2 text, col3 text, col4 text, col5 text, col6 text ) select col1 from table1 group by col1 limit 1; select distinct on (col1) col1 from table1 limit 1; select col1 from table1 group by co