Rewrite the rbtree routines so that an RBNode is the first field of the
struct representing a tree entry, rather than being a separately allocated
piece of storage. This API is at least as clean as the old one (if not
more so --- there were some bizarre choices in there) and it permits a
very substantial memory savings, on the order of 2X in ginbulk.c's usage.
Also, fix minor memory leaks in code called by ginEntryInsert, in
particular in ginInsertValue and entryFillRoot, as well as ginEntryInsert
itself. These leaks resulted in the GIN index build context continuing
to bloat even after we'd filled it to maintenance_work_mem and started
to dump data out to the index.
In combination these fixes restore the GIN index build code to honoring
the maintenance_work_mem limit about as well as it did in 8.4. Speed
seems on par with 8.4 too, maybe even a bit faster, for a non-pathological
case in which HEAD was formerly slower.
Back-patch to 9.0 so we don't have a performance regression from 8.4.
ginbtree.c (r1.15 -> r22.214.171.124)
ginbulk.c (r1.19 -> r126.96.36.199)
ginentrypage.c (r1.24 -> r188.8.131.52)
ginfast.c (r1.7 -> r184.108.40.206)
gininsert.c (r1.26 -> r220.127.116.11)
rbtree.c (r1.3 -> r18.104.22.168)
gin.h (r22.214.171.124 -> r126.96.36.199)
rbtree.h (r1.3 -> r188.8.131.52)
pgsql-committers by date
|Next:||From: Tom Lane||Date: 2010-08-01 19:16:39|
|Subject: pgsql: Fix an additional set of problems in GIN's handling of lossy page |
|Previous:||From: Tom Lane||Date: 2010-08-01 02:12:42|
|Subject: pgsql: Rewrite the rbtree routines so that an RBNode is the first field |