Re: Slow query with a lot of data - Mailing list pgsql-performance

From Matthew Wakeling
Subject Re: Slow query with a lot of data
Date
Msg-id alpine.DEB.1.10.0808191311540.4454@aragorn.flymine.org
Whole thread Raw
In response to Re: Slow query with a lot of data  (Moritz Onken <onken@houseofdesign.de>)
Responses Re: Slow query with a lot of data  (Moritz Onken <onken@houseofdesign.de>)
List pgsql-performance
On Tue, 19 Aug 2008, Moritz Onken wrote:
>        tablename        | attname | n_distinct | correlation
>  result                 | domain  |       1642 |           1

Well, the important thing is the correlation, which is 1, indicating that
Postgres knows that the table is clustered. So I have no idea why it is
sorting the entire table.

What happens when you run EXPLAIN SELECT * FROM result ORDER BY domain?

>> Sounds like an awfully long time to me. Also, I think restricting it to 280
>> users is probably not making it any faster.
>
> If I hadn't restricted it to 280 users it would have run ~350days...

What makes you say that? Perhaps you could post EXPLAINs of both of the
queries.

Matthew

--
What goes up must come down. Ask any system administrator.

pgsql-performance by date:

Previous
From: Moritz Onken
Date:
Subject: Re: Slow query with a lot of data
Next
From: Moritz Onken
Date:
Subject: Re: Slow query with a lot of data