]> granicus.if.org Git - postgresql/commit
Cache the results of ri_FetchConstraintInfo in a backend-local cache.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 20 Jun 2012 21:24:14 +0000 (17:24 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 20 Jun 2012 21:24:14 +0000 (17:24 -0400)
commit45ba424f332a7eaa685a4e23f142a43114c65811
treeba897593ad3fd072bd20a6fb345307df0eb5209f
parentcfa0f4255bb0f5550d37a01c4d8fe2966d20040c
Cache the results of ri_FetchConstraintInfo in a backend-local cache.

Extracting data from pg_constraint turned out to take as much as 10% of the
runtime in a bulk-update case where the foreign key column wasn't changing,
because we did it over again for each tuple.  Fix that by maintaining a
backend-local cache of the results.  This is really a pretty small patch,
but converting the trigger functions to work with pointers rather than
local struct variables requires a lot of mechanical changes.
src/backend/utils/adt/ri_triggers.c