]> granicus.if.org Git - postgresql/commit
Fix CatalogTupleInsert/Update abstraction for case of shared indstate.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 1 Feb 2017 22:18:36 +0000 (17:18 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 1 Feb 2017 22:18:36 +0000 (17:18 -0500)
commitaedd554f84bb3cedb32e6e2a954a70537a4da6b9
treec958b5ed639cf0359136109198f9d2e5189ba5b7
parentab02896510e26e46b830c87eef2c03dd3c52c09e
Fix CatalogTupleInsert/Update abstraction for case of shared indstate.

Add CatalogTupleInsertWithInfo and CatalogTupleUpdateWithInfo to let
callers use the CatalogTupleXXX abstraction layer even in cases where
we want to share the results of CatalogOpenIndexes across multiple
inserts/updates for efficiency.  This finishes the job begun in commit
2f5c9d9c9, by allowing some remaining simple_heap_insert/update
calls to be replaced.  The abstraction layer is now complete enough
that we don't have to export CatalogIndexInsert at all anymore.

Also, this fixes several places in which 2f5c9d9c9 introduced performance
regressions by using retail CatalogTupleInsert or CatalogTupleUpdate even
though the previous coding had been able to amortize CatalogOpenIndexes
work across multiple tuples.

A possible future improvement is to arrange for the indexing.c functions
to cache the CatalogIndexState somewhere, maybe in the relcache, in which
case we could get rid of CatalogTupleInsertWithInfo and
CatalogTupleUpdateWithInfo again.  But that's a task for another day.

Discussion: https://postgr.es/m/27502.1485981379@sss.pgh.pa.us
src/backend/catalog/heap.c
src/backend/catalog/indexing.c
src/backend/catalog/pg_depend.c
src/backend/catalog/pg_shdepend.c
src/backend/commands/cluster.c
src/backend/storage/large_object/inv_api.c
src/include/catalog/indexing.h