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.