From: | Rajkumar Raghuwanshi <rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | postgres_fdw : altering foreign table not invalidating prepare statement execution plan. |
Date: | 2016-04-04 06:17:46 |
Message-ID: | CAKcux6m5cA6rRPTKkqVdJ-R=KKDfe35Q_ZuUqxDSV_4hwga=og@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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.
CREATE EXTENSION postgres_fdw;
CREATE SCHEMA s1;
create table s1.lt (c1 integer, c2 varchar);
insert into s1.lt values (1, 's1.lt');
CREATE SCHEMA s2;
create table s2.lt (c1 integer, c2 varchar);
insert into s2.lt values (1, 's2.lt');
CREATE SERVER link_server FOREIGN DATA WRAPPER postgres_fdw OPTIONS (dbname
'postgres', port '5447', use_remote_estimate 'true');
CREATE USER MAPPING FOR public SERVER link_server;
create foreign table ft (c1 integer, c2 varchar) server link_server options
(schema_name 's1',table_name 'lt');
ANALYZE ft;
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)
EXECUTE stmt_ft;
c1 | c2
----+-------
1 | s1.lt
(1 row)
Thanks & Regards,
Rajkumar Raghuwanshi
QMG, EnterpriseDB Corporation
>
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2016-04-04 06:18:53 | Re: Timeline following for logical slots |
Previous Message | David G. Johnston | 2016-04-04 06:05:40 | Re: pgbench more operators & functions |