pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bill Moran <wmoran@collaborativefusion.com>
To: Matthew <matthew@flymine.org>
Cc: pgsql-performance@postgresql.org
Subject: Re: Appending "LIMIT" to query drastically decreases performance
Date: Fri, 30 Nov 2007 09:20:33 -0500
Message-ID: <20071130092033.f09c1ac0.wmoran@collaborativefusion.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0711301327520.3731@aragorn.flymine.org>
References: <fiordm$2aev$1@news.hub.org>
	<Pine.LNX.4.58.0711301327520.3731@aragorn.flymine.org>

In response to Matthew <matthew@flymine.org>:

> On Fri, 30 Nov 2007, cluster wrote:
> > 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)?
> 
> The planner doesn't always get it right. Simple.
> 
> Have you done a "VACUUM FULL ANALYSE" recently?

I don't know about the "FULL" part ... but certainly an ANALYZE.

Please post EXPLAIN ANALYZE output for the two queries.

-- 
Bill Moran
Collaborative Fusion Inc.
http://people.collaborativefusion.com/~wmoran/

wmoran@collaborativefusion.com
Phone: 412-422-3463x4023

****************************************************************
IMPORTANT: This message contains confidential information and is
intended only for the individual named. If the reader of this
message is not an intended recipient (or the individual
responsible for the delivery of this message to an intended
recipient), please be advised that any re-use, dissemination,
distribution or copying of this message is prohibited. Please
notify the sender immediately by e-mail if you have received
this e-mail by mistake and delete this e-mail from your system.
E-mail transmission cannot be guaranteed to be secure or
error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The
sender therefore does not accept liability for any errors or
omissions in the contents of this message, which arise as a
result of e-mail transmission.
****************************************************************



view thread (4+ messages)  latest in thread

Message-ID: <20071130092033.f09c1ac0.wmoran@collaborativefusion.com>
Permalink:  ../20071130092033.f09c1ac0.wmoran@collaborativefusion.com/
Also on:    postgresql.org/message-id/20071130092033.f09c1ac0.wmoran@collaborativefusion.com

 · 

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: wmoran@collaborativefusion.com, matthew@flymine.org
  Subject: Re: Appending "LIMIT" to query drastically decreases performance
  In-Reply-To: <20071130092033.f09c1ac0.wmoran@collaborativefusion.com>

* 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