-> Seq Scan on t2 t_2
(7 rows)
+--No.14-1-1 plancache invalidation
+CREATE TABLE s1.tpc AS SELECT a FROM generate_series(0, 999) a;
+CREATE INDEX ON s1.tpc(a);
+PREPARE p1 AS SELECT * FROM s1.tpc WHERE a < 999;
+/*+ IndexScan(tpc) */PREPARE p2 AS SELECT * FROM s1.tpc WHERE a < 999;
+/*+ SeqScan(tpc) */PREPARE p3(int) AS SELECT * FROM s1.tpc WHERE a = $1;
+EXPLAIN EXECUTE p1;
+ QUERY PLAN
+------------------------------------------------------
+ Seq Scan on tpc (cost=0.00..17.50 rows=333 width=4)
+ Filter: (a < 999)
+(2 rows)
+
+EXPLAIN EXECUTE p2;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(tpc)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------
+ Index Scan using tpc_a_idx on tpc (cost=0.28..34.10 rows=333 width=4)
+ Index Cond: (a < 999)
+(2 rows)
+
+EXPLAIN EXECUTE p3(500);
+LOG: pg_hint_plan:
+used hint:
+SeqScan(tpc)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------
+ Seq Scan on tpc (cost=0.00..17.50 rows=5 width=4)
+ Filter: (a = 500)
+(2 rows)
+
+-- The DROP invalidates the plan caches
+DROP TABLE s1.tpc;
+EXPLAIN EXECUTE p1;
+ERROR: relation "s1.tpc" does not exist
+EXPLAIN EXECUTE p2;
+ERROR: relation "s1.tpc" does not exist
+EXPLAIN EXECUTE p3(500);
+ERROR: relation "s1.tpc" does not exist
+CREATE TABLE s1.tpc AS SELECT a FROM generate_series(0, 999) a;
+CREATE INDEX ON s1.tpc(a);
+EXPLAIN EXECUTE p1;
+ QUERY PLAN
+------------------------------------------------------
+ Seq Scan on tpc (cost=0.00..17.50 rows=333 width=4)
+ Filter: (a < 999)
+(2 rows)
+
+EXPLAIN EXECUTE p2;
+LOG: pg_hint_plan:
+used hint:
+IndexScan(tpc)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+------------------------------------------------------------------------
+ Index Scan using tpc_a_idx on tpc (cost=0.28..34.10 rows=333 width=4)
+ Index Cond: (a < 999)
+(2 rows)
+
+EXPLAIN EXECUTE p3(500);
+LOG: pg_hint_plan:
+used hint:
+SeqScan(tpc)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------------------
+ Seq Scan on tpc (cost=0.00..17.50 rows=5 width=4)
+ Filter: (a = 500)
+(2 rows)
+
+DEALLOCATE p1;
+DEALLOCATE p2;
+DEALLOCATE p3;
+DROP TABLE s1.tpc;