only_index
[plantuner.git] / expected / plantuner.out
index e279d83..70d2bca 100644 (file)
@@ -1,37 +1,96 @@
 LOAD 'plantuner';
-SHOW   plantuner.forbid_index;
- plantuner.forbid_index 
-------------------------
+SHOW   plantuner.disable_index;
+ plantuner.disable_index 
+-------------------------
  
 (1 row)
 
 CREATE TABLE wow (i int, j int);
 CREATE INDEX i_idx ON wow (i);
 CREATE INDEX j_idx ON wow (j);
+CREATE INDEX i1 ON WOW (i);
+CREATE INDEX i2 ON WOW (i);
+CREATE INDEX i3 ON WOW (i);
 SET enable_seqscan=off;
 SELECT * FROM wow;
  i | j 
 ---+---
 (0 rows)
 
-SET plantuner.forbid_index="i_idx, j_idx";
+SET plantuner.disable_index="i_idx, j_idx";
 SELECT * FROM wow;
  i | j 
 ---+---
 (0 rows)
 
-SHOW plantuner.forbid_index;
-   plantuner.forbid_index   
+SHOW plantuner.disable_index;
+  plantuner.disable_index   
 ----------------------------
  public.i_idx, public.j_idx
 (1 row)
 
-SET plantuner.forbid_index="i_idx, nonexistent, public.j_idx, wow";
+SET plantuner.disable_index="i_idx, nonexistent, public.j_idx, wow";
 WARNING:  'nonexistent' does not exist
 WARNING:  'wow' is not an index
-SHOW plantuner.forbid_index;
-   plantuner.forbid_index   
+SHOW plantuner.disable_index;
+  plantuner.disable_index   
 ----------------------------
  public.i_idx, public.j_idx
 (1 row)
 
+SET plantuner.enable_index="i_idx";
+SHOW plantuner.enable_index;
+ plantuner.enable_index 
+------------------------
+ public.i_idx
+(1 row)
+
+SELECT * FROM wow;
+ i | j 
+---+---
+(0 rows)
+
+--test only index
+RESET plantuner.disable_index;
+RESET plantuner.enable_index;
+SET enable_seqscan=off;
+SET enable_bitmapscan=off;
+SET enable_indexonlyscan=off;
+SET plantuner.only_index="i1";
+SHOW plantuner.only_index;
+ plantuner.only_index 
+----------------------
+ public.i1
+(1 row)
+
+EXPLAIN (COSTS OFF) SELECT * FROM wow WHERE i = 0;
+         QUERY PLAN         
+----------------------------
+ Index Scan using i1 on wow
+   Index Cond: (i = 0)
+(2 rows)
+
+SET plantuner.disable_index="i1,i2,i3";
+EXPLAIN (COSTS OFF) SELECT * FROM wow WHERE i = 0;
+         QUERY PLAN         
+----------------------------
+ Index Scan using i1 on wow
+   Index Cond: (i = 0)
+(2 rows)
+
+SET plantuner.only_index="i2";
+EXPLAIN (COSTS OFF) SELECT * FROM wow WHERE i = 0;
+         QUERY PLAN         
+----------------------------
+ Index Scan using i2 on wow
+   Index Cond: (i = 0)
+(2 rows)
+
+RESET plantuner.only_index;
+EXPLAIN (COSTS OFF) SELECT * FROM wow WHERE i = 0;
+          QUERY PLAN           
+-------------------------------
+ Index Scan using i_idx on wow
+   Index Cond: (i = 0)
+(2 rows)
+