pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: cluster <skrald@amossen.dk>
Cc: pgsql-performance@postgresql.org
Subject: Re: Two fast queries get slow when combined
Date: Wed, 31 Oct 2007 00:05:42 -0400
Message-ID: <8481.1193803542@sss.pgh.pa.us> (raw)
In-Reply-To: <fg85ae$1740$1@news.hub.org>
References: <fg85ae$1740$1@news.hub.org>

cluster <skrald@amossen.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



view thread (5+ messages)  latest in thread

Message-ID: <8481.1193803542@sss.pgh.pa.us>
Permalink:  ../8481.1193803542@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/8481.1193803542@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, skrald@amossen.dk
  Subject: Re: Two fast queries get slow when combined
  In-Reply-To: <8481.1193803542@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox