pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kevin Grittner <kgrittn@mail.com>
Cc: Pavan Deolasee <pavan.deolasee@gmail.com>
Cc: Amitabh Kant <amitabhkant@gmail.com>
Cc: pgsql-performance <pgsql-performance@postgresql.org>
Subject: Re: Limit & offset effect on query plans
Date: Thu, 13 Dec 2012 11:20:48 -0500
Message-ID: <6012.1355415648@sss.pgh.pa.us> (raw)
In-Reply-To: <20121213154714.80050@gmx.com>
References: <20121213154714.80050@gmx.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

"Kevin Grittner" <kgrittn@mail.com> writes:
> Pavan Deolasee wrote:
>> I would tend to think that is the latter. While undoubtedly
>> limit/offset clause will add another node during query planning
>> and execution, AFAICS the OFFSET 0 and LIMIT ALL cases are
>> optimized to a good extent. So the overhead of having them will
>> not be significant.

> I ran some quick tests on my i7 under Linux. Plan time was
> increased by about 40 microseconds (based on EXPLAIN runtime) and
> added a limit node to the plan. Execution time on a SELECT * FROM
> tenk1 in the regression database went up by 1.35 ms on fully cached
> runs.

1.35ms out of what?

FWIW, I've been considering teaching the planner to not bother with
an actual Limit plan node if the limit clause is an obvious no-op.
I wasn't thinking about applications that blindly insert such clauses,
but rather about not penalizing subqueries when someone uses one of
these as an optimization fence.  (The clauses would still work as an
opt fence, you'd just not see any Limit node in the final plan.)

			regards, tom lane


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (7+ messages)  latest in thread

Message-ID: <6012.1355415648@sss.pgh.pa.us>
Permalink:  ../6012.1355415648@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/6012.1355415648@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, kgrittn@mail.com, pavan.deolasee@gmail.com, amitabhkant@gmail.com
  Subject: Re: Limit & offset effect on query plans
  In-Reply-To: <6012.1355415648@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