On Fri, Jul 31, 2009 at 1:11 PM, Kees van Dieren<keesvandieren@xxxxxxxxx> wrote: > It takes 155ms to run this query (returning 2 rows) > > Query plan: without limit: > "Sort (cost=20169.62..20409.50 rows=95952 width=16)" Could you send the results of EXPLAIN ANALYZE for both queries? Evidently the planner is expecting a lot more rows than the 2 rows you're expecting but it's not clear where it's gone wrong. -- greg http://mit.edu/~gsstark/resume.pdf -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance