]> granicus.if.org Git - postgresql/commit
Avoid copying index tuples when building an index.
authorRobert Haas <rhaas@postgresql.org>
Tue, 1 Jul 2014 14:34:42 +0000 (10:34 -0400)
committerRobert Haas <rhaas@postgresql.org>
Tue, 1 Jul 2014 14:34:42 +0000 (10:34 -0400)
commit9f03ca915196dfc871804a1f8aad26207f601fd6
tree15b68e977122a04e46917f085b7d70cedf1d3d73
parent03a25cec8de3737924c9dd33bb868d4bc7a33ad5
Avoid copying index tuples when building an index.

The previous code, perhaps out of concern for avoid memory leaks, formed
the tuple in one memory context and then copied it to another memory
context.  However, this doesn't appear to be necessary, since
index_form_tuple and the functions it calls take precautions against
leaking memory.  In my testing, building the tuple directly inside the
sort context shaves several percent off the index build time.
Rearrange things so we do that.

Patch by me.  Review by Amit Kapila, Tom Lane, Andres Freund.
src/backend/access/common/indextuple.c
src/backend/access/hash/hash.c
src/backend/access/hash/hashsort.c
src/backend/access/nbtree/nbtree.c
src/backend/access/nbtree/nbtsort.c
src/backend/utils/sort/tuplesort.c
src/include/access/hash.h
src/include/access/nbtree.h
src/include/utils/tuplesort.h