Re: Tweaking the planner's heuristics for small/empty tables

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Tweaking the planner's heuristics for small/empty tables
Date: 2011-07-13 14:59:36
Message-ID: 4388.1310569176@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> writes:
> 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.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-07-13 15:26:37 Re: Deferred partial/expression unique constraints
Previous Message Kevin Grittner 2011-07-13 14:06:25 Re: Tweaking the planner's heuristics for small/empty tables