Re: postgres_fdw : altering foreign table not invalidating prepare statement execution plan.
Amit Langote <langote_amit_f8@lab.ntt.co.jp>
From: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
To: Rajkumar Raghuwanshi <rajkumar.raghuwanshi@enterprisedb.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2016-04-04T08:45:01Z
Lists: pgsql-hackers
Attachments
- cache-inval-ft-options-1.patch (text/x-diff) patch
Hi, Thanks for the report. On 2016/04/04 15:17, Rajkumar Raghuwanshi wrote: > Hi, > > I observed below in postgres_fdw > > * .Observation: *Prepare statement execution plan is not getting changed > even after altering foreign table to point to new schema. > [ ... ] > PREPARE stmt_ft AS select c1,c2 from ft; > > EXECUTE stmt_ft; > c1 | c2 > ----+------- > 1 | s1.lt > (1 row) > > --changed foreign table ft pointing schema from s1 to s2 > ALTER foreign table ft options (SET schema_name 's2', SET table_name 'lt'); > ANALYZE ft; > > EXPLAIN (COSTS OFF, VERBOSE) EXECUTE stmt_ft; > QUERY PLAN > ---------------------------------------- > Foreign Scan on public.ft > Output: c1, c2 > Remote SQL: SELECT c1, c2 FROM s1.lt > (3 rows) I wonder if performing relcache invalidation upon ATExecGenericOptions() is the correct solution for this problem. The attached patch fixes the issue for me. Thanks, Amit
Commits
-
Invalidate cached plans on FDW option changes.
- e4380e4cf68a 9.4.11 landed
- c52d37c8b367 10.0 landed
- aaf12e577ee9 9.5.6 landed
- a8191800a6e6 9.3.16 landed
- 4103a2f200d6 9.6.2 landed