Re: Tweaking the planner's heuristics for small/empty tables - Mailing list pgsql-hackers

From Kevin Grittner
Subject Re: Tweaking the planner's heuristics for small/empty tables
Date
Msg-id 4E1D6011020000250003F295@gw.wicourts.gov
Whole thread Raw
In response to Tweaking the planner's heuristics for small/empty tables  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Tweaking the planner's heuristics for small/empty tables
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.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


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: WIP: Fast GiST index build
Next
From: Tom Lane
Date:
Subject: Re: Tweaking the planner's heuristics for small/empty tables