Re: Two fast queries get slow when combined

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: cluster <skrald(at)amossen(dot)dk>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Two fast queries get slow when combined
Date: 2007-10-31 04:05:42
Message-ID: 8481.1193803542@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

cluster <skrald(at)amossen(dot)dk> writes:
> Queries and output from EXPLAIN ANALYZE can be seen here with some
> syntax highlighting:
> http://rafb.net/p/BJIW4p69.html

You are lying to us about how those queries were posed to Postgres
(and no I don't feel a need to explain how I know). In future please
present the full truth about what you are doing, not a simplification
that you think is sufficient.

But I think the short answer to your question is that query 1 is fast
because it need only select the first 50 rows in some ordering, and
query 2 is fast because it need only select the first 50 rows in
some ordering, but they are not the same ordering so the join query
doesn't get to exploit that shortcut.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Christian Rengstl 2007-10-31 08:43:57 Re: Optimizing PostgreSQL for Windows
Previous Message Heikki Linnakangas 2007-10-30 21:46:45 Re: Two fast queries get slow when combined