Re: Slow query with a lot of data

From: Matthew Wakeling <matthew(at)flymine(dot)org>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Slow query with a lot of data
Date: 2008-08-19 12:17:25
Message-ID: alpine.DEB.1.10.0808191311540.4454@aragorn.flymine.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Moritz Onken 2008-08-19 12:47:33 Re: Slow query with a lot of data
Previous Message Moritz Onken 2008-08-19 11:39:15 Re: Slow query with a lot of data