pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: cluster <skrald@amossen.dk>
To: pgsql-performance@postgresql.org
Subject: Appending "LIMIT" to query drastically decreases performance
Date: Fri, 30 Nov 2007 12:16:08 +0100
Message-ID: <fiordm$2aev$1@news.hub.org> (raw)

Can anyone explain the following odd behavior?
I have a query that completes in about 90 ms. If I append LIMIT to the 
very end, eg. "LIMIT 500" the evaluation time increases to about 800 ms.
How can performance get *worse* by giving the database the option to 
stop the evaluation earlier (when it reaches the output 500 rows)?

I have pasted both queries together with output from explain analyze here:
    http://pastebin.com/m3c0d1896



view thread (4+ messages)  latest in thread

Message-ID: <fiordm$2aev$1@news.hub.org>
Permalink:  ../fiordm$2aev$1@news.hub.org/
Also on:    postgresql.org/message-id/fiordm$2aev$1@news.hub.org

 · 

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: skrald@amossen.dk
  Subject: Re: Appending "LIMIT" to query drastically decreases performance
  In-Reply-To: <fiordm$2aev$1@news.hub.org>

* 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