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.