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

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

Huh?  I think you misread the test.  Keep in mind that the starting
value of curpages is the actual current size of the relation (as
reported by lseek(SEEK_END)).  The clamp action is triggering if
pg_class.relpages is zero, indicating (approximately) that we've never
yet run vacuum on the relation.

BTW, in some quick testing it seems like a newly-created index will
start out with relpages nonzero anyway, making the point moot; so adding
a relkind test here is really more documentation than anything else.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: Tweaking the planner's heuristics for small/empty tables
Next
From: Tom Lane
Date:
Subject: Re: Deferred partial/expression unique constraints