Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Another thing that struck me while looking at the code is that the
> curpages clamp is applied to indexes too, which seems like a
> thinko. A table occupying a few pages wouldn't likely have an
> index as big as the table itself is.
But not zero pages, either.
> So what I'm currently thinking about is a change like this:
>
> if (curpages < 10 &&
> rel->rd_rel->relpages == 0 &&
> !rel->rd_rel->relhassubclass &&
> rel->rd_rel->relkind != RELKIND_INDEX)
> curpages = 10;
Rather than assume ten heap pages and zero index pages, how about
something like:
if (curpages < 10 &&
rel->rd_rel->relpages == 0 &&
!rel->rd_rel->relhassubclass)
curpages = (rel->rd_rel->relkind == RELKIND_INDEX) ? 1 : 10;
> This seems like a safe enough change to apply to 9.1. Going
> forward we might want to change it more, but I think it'd require
> some real-world testing.
I'd be a little nervous about a change which put indexes all the way
to zero without serious testing; otherwise, agreed.
-Kevin