refactor index build

Started by Neil Conwayover 21 years ago2 messagespatches
Jump to latest
#1Neil Conway
neilc@samurai.com

This patch refactors away some duplicated code in the index AM build
methods: they all invoke UpdateStats() since they have computed the
number of heap tuples, so I created a function in catalog/index.c that
each AM calls. This is per earlier discussion (it was included in the
GiST patches I submitted a while back, but I'm breaking those patches up
into smaller chunks now).

Barring any objections, I'll apply this later today or tomorrow.

-Neil

Attachments:

index_update_stats_refactor-1.patchtext/x-patch; name=index_update_stats_refactor-1.patchDownload+128-97
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Neil Conway (#1)
Re: refactor index build

Neil Conway <neilc@samurai.com> writes:

This patch refactors away some duplicated code in the index AM build
methods: they all invoke UpdateStats() since they have computed the
number of heap tuples, so I created a function in catalog/index.c that
each AM calls. This is per earlier discussion

No objection here, although it seems like only a minor issue.

The part of index build that's always gotten my goat is the business
about bootstrap mode opening and closing stuff in different places than
normal mode (see the XXX near the bottom of index_create). If you're
feeling like improving the code cleanliness in this area, that would be
a great little exercise.

(For that matter, I suspect the bootstrap-time distinction between index
define and index build is not needed any more at all; we define them all
in a row at the end of bootstrap, so why not fill them in when defined
and make it exactly like the normal CREATE INDEX path?)

regards, tom lane