Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2026-04-30 9f2ef60949ced4fab4d077a7e1c6d913f3620c9b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
LOAD 'plantuner';
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.disable_index="i_idx, j_idx";
SELECT * FROM wow;
 i | j 
---+---
(0 rows)
 
SHOW plantuner.disable_index;
  plantuner.disable_index   
----------------------------
 public.i_idx, public.j_idx
(1 row)
 
SET plantuner.disable_index="i_idx, nonexistent, public.j_idx, wow";
WARNING:  'nonexistent' does not exist
WARNING:  'wow' is not an 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)