Skip site navigation (1) Skip section navigation (2)

pgsql: Cache the results of ri_FetchConstraintInfo in a backend-localc

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Cache the results of ri_FetchConstraintInfo in a backend-localc
Date: 2012-06-20 21:24:53
Message-ID: E1ShSOT-0004ac-M6@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/45ba424f332a7eaa685a4e23f142a43114c65811

Modified Files
--------------
src/backend/utils/adt/ri_triggers.c |  548 ++++++++++++++++++++---------------
1 files changed, 319 insertions(+), 229 deletions(-)

pgsql-committers by date

Next:From: Tom LaneDate: 2012-06-20 23:48:14
Subject: pgsql: Increase MAX_SYSCACHE_CALLBACKS from 20 to 32.
Previous:From: Magnus HaganderDate: 2012-06-20 09:40:13
Subject: Re: pgsql: Remove confusing half sentence from legal notice

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group