From 1908abc4a37d397356c9cdf0fd31c33a86281d63 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 6 Mar 2013 23:47:38 -0500 Subject: Arrange to cache FdwRoutine structs in foreign tables' relcache entries. This saves several catalog lookups per reference. It's not all that exciting right now, because we'd managed to minimize the number of places that need to fetch the data; but the upcoming writable-foreign-tables patch needs this info in a lot more places. --- src/backend/utils/cache/relcache.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/backend/utils/cache/relcache.c') diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index ba03dfcbb2d..5b1d1e5b10a 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -1846,6 +1846,8 @@ RelationDestroyRelation(Relation relation) MemoryContextDelete(relation->rd_indexcxt); if (relation->rd_rulescxt) MemoryContextDelete(relation->rd_rulescxt); + if (relation->rd_fdwroutine) + pfree(relation->rd_fdwroutine); pfree(relation); } @@ -4410,7 +4412,7 @@ load_relcache_init_file(bool shared) * format is complex and subject to change). They must be rebuilt if * needed by RelationCacheInitializePhase3. This is not expected to * be a big performance hit since few system catalogs have such. Ditto - * for index expressions, predicates, and exclusion info. + * for index expressions, predicates, exclusion info, and FDW info. */ rel->rd_rules = NULL; rel->rd_rulescxt = NULL; @@ -4420,6 +4422,7 @@ load_relcache_init_file(bool shared) rel->rd_exclops = NULL; rel->rd_exclprocs = NULL; rel->rd_exclstrats = NULL; + rel->rd_fdwroutine = NULL; /* * Reset transient-state fields in the relcache entry -- cgit v1.2.3