• Tom Lane's avatar
    Fix CatalogTupleInsert/Update abstraction for case of shared indstate. · aedd554f
    Tom Lane authored
    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
    2f5c9d9c, 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 2f5c9d9c 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
    aedd554f
indexing.h 18.6 KB