Re: parameterized limit statements

From: Csaba Nagy <nagy(at)ecircle-ag(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Merlin Moncure <merlin(dot)moncure(at)rcsonline(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: parameterized limit statements
Date: 2005-11-08 09:48:28
Message-ID: 1131443308.4892.61.camel@coppola.muc.ecircle.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 2005-11-07 at 18:43, Tom Lane wrote:
[snip]
> If it doesn't have a value for the parameter, it'll assume 10% of table
> rows, which is what it's done for a long time if the LIMIT isn't
> reducible to a constant.

Is 10% a reasonable guess here ?

Here we use limit in combination with prepared statements to get
something like less than 1% of the table. There are no exceptions to
that in our code... even if the limit amount is a parameter.

Furthermore, the limit amount is always a small number, usually ~ 100,
but never more than 1000. So in my case, we could live with a suboptimal
plan when the percentage would be more than 10%, cause then the table
would be small enough not to matter that much. In turn it has a huge
impact to wrongly guess 10% for a huge table...

I think the best would be to guess 5% but maximum say 5000. That could
work well with both small and huge tables. Maybe those values could be
made configurable... just ideas, not like I could implement this...

[snip]

Cheers,
Csaba.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Teodor Sigaev 2005-11-08 12:13:32 Re: SIGSEGV taken on 8.1 during dump/reload
Previous Message Sreejesh O S 2005-11-08 09:22:10 Is there any other way to compile pgsql without gmake