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 -> r18.104.22.168)
ginbulk.c (r1.19 -> r22.214.171.124)
ginentrypage.c (r1.24 -> r126.96.36.199)
ginfast.c (r1.7 -> r188.8.131.52)
gininsert.c (r1.26 -> r184.108.40.206)
rbtree.c (r1.3 -> r220.127.116.11)
gin.h (r18.104.22.168 -> r22.214.171.124)
rbtree.h (r1.3 -> r126.96.36.199)
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 |