Re: Variable LIMIT and OFFSET in SELECTs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sam Mason <sam(at)samason(dot)me(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Variable LIMIT and OFFSET in SELECTs
Date: 2007-11-15 17:45:08
Message-ID: 5823.1195148708@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Sam Mason <sam(at)samason(dot)me(dot)uk> writes:
> On Thu, Nov 15, 2007 at 06:08:20PM +0100, Reg Me Please wrote:
>> But then why allowing the LIMIT and the OFFSET as coming from function
>> argument evaluations?

> I believe the query is planned by ignoring the LIMIT and OFFSET.

No, it still knows there will be a LIMIT in effect, but it has to guess
at how tight the limit is. From memory I think it assumes 10% of the
total rows will be retrieved, which is a compromise to try to avoid
being spectacularly bad for either small or large limits.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2007-11-15 17:50:05 Re: PLpgsql debugger question
Previous Message Tom Lane 2007-11-15 17:38:20 Re: PostgreSQL 8.2.5 compile problem