Skip to content

Commit e210b69

Browse files
author
Potapov Alexander
committed
Support new Optimizer's behaviour in regression tests
1 parent b6e5430 commit e210b69

11 files changed

+94
-48
lines changed

expected/array.out

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,9 @@ EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
521521
QUERY PLAN
522522
----------------------------------
523523
Seq Scan on test_array
524+
Disabled Nodes: 1
524525
Filter: (i % '{}'::smallint[])
525-
(2 rows)
526+
(3 rows)
526527

527528
EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{1}' ORDER BY add_info <=> '2016-05-16 14:21:25' LIMIT 10;
528529
QUERY PLAN

expected/array_1.out

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,9 @@ EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
521521
QUERY PLAN
522522
----------------------------------
523523
Seq Scan on test_array
524+
Disabled Nodes: 1
524525
Filter: (i % '{}'::smallint[])
525-
(2 rows)
526+
(3 rows)
526527

527528
EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{1}' ORDER BY add_info <=> '2016-05-16 14:21:25' LIMIT 10;
528529
QUERY PLAN

expected/orderby.out

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,16 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY
194194

195195
EXPLAIN (costs off)
196196
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
197-
QUERY PLAN
198-
-----------------------------------------------------------------------------------
197+
QUERY PLAN
198+
-------------------------------------------------------------------------------------
199199
Limit
200-
-> Index Scan using tsts_idx on tsts
201-
Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
202-
(3 rows)
200+
Disabled Nodes: 1
201+
-> Sort
202+
Disabled Nodes: 1
203+
Sort Key: ((d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone))
204+
-> Seq Scan on tsts
205+
Disabled Nodes: 1
206+
(7 rows)
203207

204208
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
205209
id | d | ?column?

expected/orderby_1.out

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,27 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY
194194

195195
EXPLAIN (costs off)
196196
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
197-
QUERY PLAN
198-
-----------------------------------------------------------------------------------
197+
QUERY PLAN
198+
-------------------------------------------------------------------------------------
199199
Limit
200-
-> Index Scan using tsts_idx on tsts
201-
Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
202-
(3 rows)
200+
Disabled Nodes: 1
201+
-> Sort
202+
Disabled Nodes: 1
203+
Sort Key: ((d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone))
204+
-> Seq Scan on tsts
205+
Disabled Nodes: 1
206+
(7 rows)
203207

204208
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
205-
ERROR: doesn't support order by over pass-by-reference column
209+
id | d | ?column?
210+
-----+---------------------------------+-------------
211+
355 | Mon May 16 14:21:22.326724 2016 | 2.673276
212+
356 | Mon May 16 15:21:22.326724 2016 | 3597.326724
213+
354 | Mon May 16 13:21:22.326724 2016 | 3602.673276
214+
357 | Mon May 16 16:21:22.326724 2016 | 7197.326724
215+
353 | Mon May 16 12:21:22.326724 2016 | 7202.673276
216+
(5 rows)
217+
206218
EXPLAIN (costs off)
207219
SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
208220
QUERY PLAN

expected/orderby_hash.out

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,16 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY
194194

195195
EXPLAIN (costs off)
196196
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
197-
QUERY PLAN
198-
-----------------------------------------------------------------------------------
197+
QUERY PLAN
198+
-------------------------------------------------------------------------------------
199199
Limit
200-
-> Index Scan using tstsh_idx on tstsh
201-
Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
202-
(3 rows)
200+
Disabled Nodes: 1
201+
-> Sort
202+
Disabled Nodes: 1
203+
Sort Key: ((d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone))
204+
-> Seq Scan on tstsh
205+
Disabled Nodes: 1
206+
(7 rows)
203207

204208
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
205209
id | d | ?column?

expected/orderby_hash_1.out

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,27 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY
194194

195195
EXPLAIN (costs off)
196196
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
197-
QUERY PLAN
198-
-----------------------------------------------------------------------------------
197+
QUERY PLAN
198+
-------------------------------------------------------------------------------------
199199
Limit
200-
-> Index Scan using tstsh_idx on tstsh
201-
Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
202-
(3 rows)
200+
Disabled Nodes: 1
201+
-> Sort
202+
Disabled Nodes: 1
203+
Sort Key: ((d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone))
204+
-> Seq Scan on tstsh
205+
Disabled Nodes: 1
206+
(7 rows)
203207

204208
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
205-
ERROR: doesn't support order by over pass-by-reference column
209+
id | d | ?column?
210+
-----+---------------------------------+-------------
211+
355 | Mon May 16 14:21:22.326724 2016 | 2.673276
212+
356 | Mon May 16 15:21:22.326724 2016 | 3597.326724
213+
354 | Mon May 16 13:21:22.326724 2016 | 3602.673276
214+
357 | Mon May 16 16:21:22.326724 2016 | 7197.326724
215+
353 | Mon May 16 12:21:22.326724 2016 | 7202.673276
216+
(5 rows)
217+
206218
EXPLAIN (costs off)
207219
SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
208220
QUERY PLAN

expected/rum.out

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ SELECT
2121
CREATE INDEX failed_rumidx ON test_rum USING rum (a rum_tsvector_addon_ops);
2222
ERROR: additional information attribute "a" is not found in index
2323
SET enable_seqscan=off;
24-
SET enable_indexscan=off;
24+
SET enable_indexscan=on;
2525
explain (costs off)
2626
SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', 'ever|wrote');
2727
QUERY PLAN
@@ -49,14 +49,12 @@ ORDER BY a <=> to_tsquery('pg_catalog.english', 'ever|wrote');
4949
explain (costs off)
5050
SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english',
5151
'def <-> fgr');
52-
QUERY PLAN
53-
-----------------------------------------------------------------
52+
QUERY PLAN
53+
-----------------------------------------------------------
5454
Aggregate
55-
-> Bitmap Heap Scan on test_rum
56-
Recheck Cond: (a @@ '''def'' <-> ''fgr'''::tsquery)
57-
-> Bitmap Index Scan on rumidx
58-
Index Cond: (a @@ '''def'' <-> ''fgr'''::tsquery)
59-
(5 rows)
55+
-> Index Scan using rumidx on test_rum
56+
Index Cond: (a @@ '''def'' <-> ''fgr'''::tsquery)
57+
(3 rows)
6058

6159
SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', 'ever|wrote');
6260
count
@@ -163,6 +161,7 @@ SELECT
163161
rum_ts_distance(a, to_tsquery('pg_catalog.english', 'way & (go | half)'))::numeric(10,4),
164162
*
165163
FROM test_rum
164+
WHERE a @@ to_tsquery('pg_catalog.english', 'way & (go | half)')
166165
ORDER BY a <=> to_tsquery('pg_catalog.english', 'way & (go | half)') limit 2;
167166
distance | rum_ts_distance | t | a
168167
----------+-----------------+---------------------------------------------------------------------+---------------------------------------------------------

expected/rum_hash.out

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ CREATE INDEX rumhashidx ON test_rum_hash USING rum (a rum_tsvector_hash_ops);
77
CREATE INDEX failed_rumidx ON test_rum_hash USING rum (a rum_tsvector_addon_ops);
88
ERROR: additional information attribute "a" is not found in index
99
SET enable_seqscan=off;
10-
SET enable_indexscan=off;
10+
SET enable_indexscan=on;
1111
explain (costs off)
1212
SELECT count(*) FROM test_rum_hash WHERE a @@ to_tsquery('pg_catalog.english', 'ever|wrote');
1313
QUERY PLAN
@@ -35,14 +35,12 @@ ORDER BY a <=> to_tsquery('pg_catalog.english', 'ever|wrote');
3535
explain (costs off)
3636
SELECT count(*) FROM test_rum_hash WHERE a @@ to_tsquery('pg_catalog.english',
3737
'def <-> fgr');
38-
QUERY PLAN
39-
-----------------------------------------------------------------
38+
QUERY PLAN
39+
-----------------------------------------------------------
4040
Aggregate
41-
-> Bitmap Heap Scan on test_rum_hash
42-
Recheck Cond: (a @@ '''def'' <-> ''fgr'''::tsquery)
43-
-> Bitmap Index Scan on rumhashidx
44-
Index Cond: (a @@ '''def'' <-> ''fgr'''::tsquery)
45-
(5 rows)
41+
-> Index Scan using rumhashidx on test_rum_hash
42+
Index Cond: (a @@ '''def'' <-> ''fgr'''::tsquery)
43+
(3 rows)
4644

4745
SELECT count(*) FROM test_rum_hash WHERE a @@ to_tsquery('pg_catalog.english', 'ever|wrote');
4846
count
@@ -150,6 +148,7 @@ SELECT
150148
rum_ts_score(a, to_tsquery('pg_catalog.english', 'way & (go | half)'))::numeric(10,6),
151149
*
152150
FROM test_rum_hash
151+
WHERE a @@ to_tsquery('pg_catalog.english', 'way & (go | half)')
153152
ORDER BY a <=> to_tsquery('pg_catalog.english', 'way & (go | half)') limit 2;
154153
distance | rum_ts_distance | rum_ts_score | t | a
155154
----------+-----------------+--------------+---------------------------------------------------------------------+---------------------------------------------------------

expected/text.out

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,11 @@ SELECT count(*) FROM test_text_a WHERE id < '400';
135135
QUERY PLAN
136136
------------------------------------
137137
Aggregate
138+
Disabled Nodes: 1
138139
-> Seq Scan on test_text_a
140+
Disabled Nodes: 1
139141
Filter: (id < '400'::text)
140-
(3 rows)
142+
(5 rows)
141143

142144
SELECT count(*) FROM test_text_a WHERE id < '400';
143145
count
@@ -150,10 +152,12 @@ SELECT id FROM test_text_a WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
150152
QUERY PLAN
151153
-----------------------------------------------------------------------------
152154
Sort
155+
Disabled Nodes: 1
153156
Sort Key: id
154157
-> Seq Scan on test_text_a
158+
Disabled Nodes: 1
155159
Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::text))
156-
(4 rows)
160+
(6 rows)
157161

158162
SELECT id FROM test_text_a WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
159163
id
@@ -174,10 +178,12 @@ SELECT id FROM test_text_a WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
174178
QUERY PLAN
175179
-----------------------------------------------------------------------------
176180
Sort
181+
Disabled Nodes: 1
177182
Sort Key: id
178183
-> Seq Scan on test_text_a
184+
Disabled Nodes: 1
179185
Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::text))
180-
(4 rows)
186+
(6 rows)
181187

182188
SELECT id FROM test_text_a WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
183189
id
@@ -254,9 +260,11 @@ SELECT count(*) FROM test_text_h_a WHERE id < '400';
254260
QUERY PLAN
255261
------------------------------------
256262
Aggregate
263+
Disabled Nodes: 1
257264
-> Seq Scan on test_text_h_a
265+
Disabled Nodes: 1
258266
Filter: (id < '400'::text)
259-
(3 rows)
267+
(5 rows)
260268

261269
SELECT count(*) FROM test_text_h_a WHERE id < '400';
262270
count
@@ -269,10 +277,12 @@ SELECT id FROM test_text_h_a WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
269277
QUERY PLAN
270278
-----------------------------------------------------------------------------
271279
Sort
280+
Disabled Nodes: 1
272281
Sort Key: id
273282
-> Seq Scan on test_text_h_a
283+
Disabled Nodes: 1
274284
Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::text))
275-
(4 rows)
285+
(6 rows)
276286

277287
SELECT id FROM test_text_h_a WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
278288
id
@@ -293,10 +303,12 @@ SELECT id FROM test_text_h_a WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
293303
QUERY PLAN
294304
-----------------------------------------------------------------------------
295305
Sort
306+
Disabled Nodes: 1
296307
Sort Key: id
297308
-> Seq Scan on test_text_h_a
309+
Disabled Nodes: 1
298310
Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::text))
299-
(4 rows)
311+
(6 rows)
300312

301313
SELECT id FROM test_text_h_a WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
302314
id

sql/rum.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ SELECT
2222
CREATE INDEX failed_rumidx ON test_rum USING rum (a rum_tsvector_addon_ops);
2323

2424
SET enable_seqscan=off;
25-
SET enable_indexscan=off;
25+
SET enable_indexscan=on;
2626

2727
explain (costs off)
2828
SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', 'ever|wrote');
@@ -64,6 +64,7 @@ SELECT
6464
rum_ts_distance(a, to_tsquery('pg_catalog.english', 'way & (go | half)'))::numeric(10,4),
6565
*
6666
FROM test_rum
67+
WHERE a @@ to_tsquery('pg_catalog.english', 'way & (go | half)')
6768
ORDER BY a <=> to_tsquery('pg_catalog.english', 'way & (go | half)') limit 2;
6869

6970
-- Check ranking normalization

sql/rum_hash.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ CREATE INDEX rumhashidx ON test_rum_hash USING rum (a rum_tsvector_hash_ops);
1010
CREATE INDEX failed_rumidx ON test_rum_hash USING rum (a rum_tsvector_addon_ops);
1111

1212
SET enable_seqscan=off;
13-
SET enable_indexscan=off;
13+
SET enable_indexscan=on;
1414

1515
explain (costs off)
1616
SELECT count(*) FROM test_rum_hash WHERE a @@ to_tsquery('pg_catalog.english', 'ever|wrote');
@@ -53,6 +53,7 @@ SELECT
5353
rum_ts_score(a, to_tsquery('pg_catalog.english', 'way & (go | half)'))::numeric(10,6),
5454
*
5555
FROM test_rum_hash
56+
WHERE a @@ to_tsquery('pg_catalog.english', 'way & (go | half)')
5657
ORDER BY a <=> to_tsquery('pg_catalog.english', 'way & (go | half)') limit 2;
5758

5859
-- Check ranking normalization

0 commit comments

Comments
 (0)