From 28cbafac734eb14b61e50f433ce45084792ace53 Mon Sep 17 00:00:00 2001 From: Potapov Alexander Date: Sat, 8 Feb 2025 09:47:29 +0300 Subject: [PATCH] Support new Optimizer's behaviour in regression tests --- expected/altorder_1.out | 44 ++++++++++++++++++++------- expected/altorder_hash_1.out | 40 +++++++++++++++++++------ expected/array.out | 3 +- expected/array_1.out | 3 +- expected/int8_1.out | 58 ++++++++++++++++++++++++++++-------- expected/orderby.out | 14 +++++---- expected/orderby_1.out | 24 +++++++++++---- expected/orderby_hash.out | 14 +++++---- expected/orderby_hash_1.out | 24 +++++++++++---- expected/rum.out | 1 + expected/rum_hash.out | 1 + expected/text.out | 24 +++++++++++---- sql/rum.sql | 1 + sql/rum_hash.sql | 1 + 14 files changed, 190 insertions(+), 62 deletions(-) diff --git a/expected/altorder_1.out b/expected/altorder_1.out index 980515f58e..2ebea27b47 100644 --- a/expected/altorder_1.out +++ b/expected/altorder_1.out @@ -185,9 +185,11 @@ SELECT count(*) FROM atsts WHERE t @@ 'wr|qh'; QUERY PLAN --------------------------------------------------- Aggregate + Disabled Nodes: 1 -> Seq Scan on atsts + Disabled Nodes: 1 Filter: (t @@ '''wr'' | ''qh'''::tsquery) -(3 rows) +(5 rows) SELECT count(*) FROM atsts WHERE t @@ 'wr|qh'; count @@ -230,9 +232,11 @@ SELECT count(*) FROM atsts WHERE d < '2016-05-16 14:21:25'; QUERY PLAN ------------------------------------------------------------------------------- Aggregate + Disabled Nodes: 1 -> Seq Scan on atsts + Disabled Nodes: 1 Filter: (d < 'Mon May 16 14:21:25 2016'::timestamp without time zone) -(3 rows) +(5 rows) SELECT count(*) FROM atsts WHERE d < '2016-05-16 14:21:25'; count @@ -245,9 +249,11 @@ SELECT count(*) FROM atsts WHERE d > '2016-05-16 14:21:25'; QUERY PLAN ------------------------------------------------------------------------------- Aggregate + Disabled Nodes: 1 -> Seq Scan on atsts + Disabled Nodes: 1 Filter: (d > 'Mon May 16 14:21:25 2016'::timestamp without time zone) -(3 rows) +(5 rows) SELECT count(*) FROM atsts WHERE d > '2016-05-16 14:21:25'; count @@ -264,11 +270,14 @@ SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY QUERY PLAN ------------------------------------------------------------------------------------- Limit + Disabled Nodes: 1 -> Sort + Disabled Nodes: 1 Sort Key: ((d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)) -> Seq Scan on atsts + Disabled Nodes: 1 Filter: (t @@ '''wr'' & ''qh'''::tsquery) -(5 rows) +(8 rows) SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; id | d | ?column? @@ -285,11 +294,14 @@ SELECT id, d, d <=| '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY QUERY PLAN ------------------------------------------------------------------------------------- Limit + Disabled Nodes: 1 -> Sort + Disabled Nodes: 1 Sort Key: ((d <=| 'Mon May 16 14:21:25 2016'::timestamp without time zone)) -> Seq Scan on atsts + Disabled Nodes: 1 Filter: (t @@ '''wr'' & ''qh'''::tsquery) -(5 rows) +(8 rows) SELECT id, d, d <=| '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY d <=| '2016-05-16 14:21:25' LIMIT 5; id | d | ?column? @@ -306,11 +318,14 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY QUERY PLAN ------------------------------------------------------------------------------------- Limit + Disabled Nodes: 1 -> Sort + Disabled Nodes: 1 Sort Key: ((d |=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)) -> Seq Scan on atsts + Disabled Nodes: 1 Filter: (t @@ '''wr'' & ''qh'''::tsquery) -(5 rows) +(8 rows) SELECT id, d, d |=> '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5; id | d | ?column? @@ -327,10 +342,13 @@ SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atsts ORDER BY d <=> '2016-05-16 QUERY PLAN ------------------------------------------------------------------------------------- Limit + Disabled Nodes: 1 -> Sort + Disabled Nodes: 1 Sort Key: ((d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)) -> Seq Scan on atsts -(4 rows) + Disabled Nodes: 1 +(7 rows) SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; id | d | ?column? @@ -347,10 +365,12 @@ SELECT id, d FROM atsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ Sort + Disabled Nodes: 1 Sort Key: d -> Seq Scan on atsts + Disabled Nodes: 1 Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (d <= 'Mon May 16 14:21:25 2016'::timestamp without time zone)) -(4 rows) +(6 rows) SELECT id, d FROM atsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; id | d @@ -398,10 +418,12 @@ SELECT id, d FROM atsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ Sort + Disabled Nodes: 1 Sort Key: d -> Seq Scan on atsts + Disabled Nodes: 1 Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (d >= 'Mon May 16 14:21:25 2016'::timestamp without time zone)) -(4 rows) +(6 rows) SELECT id, d FROM atsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d; id | d @@ -445,10 +467,12 @@ SELECT id, d FROM atsts WHERE t @@ 'wr&q:*' AND d >= '2016-05-16 14:21:25' ORDE QUERY PLAN ------------------------------------------------------------------------------------------------------------------------- Sort + Disabled Nodes: 1 Sort Key: d -> Seq Scan on atsts + Disabled Nodes: 1 Filter: ((t @@ '''wr'' & ''q'':*'::tsquery) AND (d >= 'Mon May 16 14:21:25 2016'::timestamp without time zone)) -(4 rows) +(6 rows) SELECT id, d FROM atsts WHERE t @@ 'wr&q:*' AND d >= '2016-05-16 14:21:25' ORDER BY d; id | d diff --git a/expected/altorder_hash_1.out b/expected/altorder_hash_1.out index e310fbdb89..818ccbe06d 100644 --- a/expected/altorder_hash_1.out +++ b/expected/altorder_hash_1.out @@ -130,9 +130,11 @@ SELECT count(*) FROM atstsh WHERE t @@ 'wr|qh'; QUERY PLAN --------------------------------------------------- Aggregate + Disabled Nodes: 1 -> Seq Scan on atstsh + Disabled Nodes: 1 Filter: (t @@ '''wr'' | ''qh'''::tsquery) -(3 rows) +(5 rows) SELECT count(*) FROM atstsh WHERE t @@ 'wr|qh'; count @@ -175,9 +177,11 @@ SELECT count(*) FROM atstsh WHERE d < '2016-05-16 14:21:25'; QUERY PLAN ------------------------------------------------------------------------------- Aggregate + Disabled Nodes: 1 -> Seq Scan on atstsh + Disabled Nodes: 1 Filter: (d < 'Mon May 16 14:21:25 2016'::timestamp without time zone) -(3 rows) +(5 rows) SELECT count(*) FROM atstsh WHERE d < '2016-05-16 14:21:25'; count @@ -190,9 +194,11 @@ SELECT count(*) FROM atstsh WHERE d > '2016-05-16 14:21:25'; QUERY PLAN ------------------------------------------------------------------------------- Aggregate + Disabled Nodes: 1 -> Seq Scan on atstsh + Disabled Nodes: 1 Filter: (d > 'Mon May 16 14:21:25 2016'::timestamp without time zone) -(3 rows) +(5 rows) SELECT count(*) FROM atstsh WHERE d > '2016-05-16 14:21:25'; count @@ -209,11 +215,14 @@ SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER B QUERY PLAN ------------------------------------------------------------------------------------- Limit + Disabled Nodes: 1 -> Sort + Disabled Nodes: 1 Sort Key: ((d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)) -> Seq Scan on atstsh + Disabled Nodes: 1 Filter: (t @@ '''wr'' & ''qh'''::tsquery) -(5 rows) +(8 rows) SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; id | d | ?column? @@ -230,11 +239,14 @@ SELECT id, d, d <=| '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER B QUERY PLAN ------------------------------------------------------------------------------------- Limit + Disabled Nodes: 1 -> Sort + Disabled Nodes: 1 Sort Key: ((d <=| 'Mon May 16 14:21:25 2016'::timestamp without time zone)) -> Seq Scan on atstsh + Disabled Nodes: 1 Filter: (t @@ '''wr'' & ''qh'''::tsquery) -(5 rows) +(8 rows) SELECT id, d, d <=| '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d <=| '2016-05-16 14:21:25' LIMIT 5; id | d | ?column? @@ -251,11 +263,14 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER B QUERY PLAN ------------------------------------------------------------------------------------- Limit + Disabled Nodes: 1 -> Sort + Disabled Nodes: 1 Sort Key: ((d |=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)) -> Seq Scan on atstsh + Disabled Nodes: 1 Filter: (t @@ '''wr'' & ''qh'''::tsquery) -(5 rows) +(8 rows) SELECT id, d, d |=> '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5; id | d | ?column? @@ -272,10 +287,13 @@ SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atstsh ORDER BY d <=> '2016-05-16 QUERY PLAN ------------------------------------------------------------------------------------- Limit + Disabled Nodes: 1 -> Sort + Disabled Nodes: 1 Sort Key: ((d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)) -> Seq Scan on atstsh -(4 rows) + Disabled Nodes: 1 +(7 rows) SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; id | d | ?column? @@ -292,10 +310,12 @@ SELECT id, d FROM atstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDE QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ Sort + Disabled Nodes: 1 Sort Key: d -> Seq Scan on atstsh + Disabled Nodes: 1 Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (d <= 'Mon May 16 14:21:25 2016'::timestamp without time zone)) -(4 rows) +(6 rows) SELECT id, d FROM atstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; id | d @@ -316,10 +336,12 @@ SELECT id, d FROM atstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDE QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ Sort + Disabled Nodes: 1 Sort Key: d -> Seq Scan on atstsh + Disabled Nodes: 1 Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (d >= 'Mon May 16 14:21:25 2016'::timestamp without time zone)) -(4 rows) +(6 rows) SELECT id, d FROM atstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d; id | d diff --git a/expected/array.out b/expected/array.out index a2fb3bb8df..1f43dfd29c 100644 --- a/expected/array.out +++ b/expected/array.out @@ -521,8 +521,9 @@ EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}'; QUERY PLAN ---------------------------------- Seq Scan on test_array + Disabled Nodes: 1 Filter: (i % '{}'::smallint[]) -(2 rows) +(3 rows) EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{1}' ORDER BY add_info <=> '2016-05-16 14:21:25' LIMIT 10; QUERY PLAN diff --git a/expected/array_1.out b/expected/array_1.out index cc5f93307c..241afb80f6 100644 --- a/expected/array_1.out +++ b/expected/array_1.out @@ -521,8 +521,9 @@ EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}'; QUERY PLAN ---------------------------------- Seq Scan on test_array + Disabled Nodes: 1 Filter: (i % '{}'::smallint[]) -(2 rows) +(3 rows) EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{1}' ORDER BY add_info <=> '2016-05-16 14:21:25' LIMIT 10; QUERY PLAN diff --git a/expected/int8_1.out b/expected/int8_1.out index ffced0aaf8..de828353ed 100644 --- a/expected/int8_1.out +++ b/expected/int8_1.out @@ -233,9 +233,11 @@ SELECT count(*) FROM test_int8_a WHERE id < 400::int8; QUERY PLAN -------------------------------------- Aggregate + Disabled Nodes: 1 -> Seq Scan on test_int8_a + Disabled Nodes: 1 Filter: (id < '400'::bigint) -(3 rows) +(5 rows) SELECT count(*) FROM test_int8_a WHERE id < 400::int8; count @@ -248,11 +250,14 @@ SELECT id, id <=> 400 FROM test_int8_a WHERE t @@ 'wr&qh' ORDER BY id <=> 400 LI QUERY PLAN --------------------------------------------------------- Limit + Disabled Nodes: 1 -> Sort + Disabled Nodes: 1 Sort Key: ((id <=> '400'::bigint)) -> Seq Scan on test_int8_a + Disabled Nodes: 1 Filter: (t @@ '''wr'' & ''qh'''::tsquery) -(5 rows) +(8 rows) SELECT id, id <=> 400 FROM test_int8_a WHERE t @@ 'wr&qh' ORDER BY id <=> 400 LIMIT 5; id | ?column? @@ -269,11 +274,14 @@ SELECT id, id <=| 400 FROM test_int8_a WHERE t @@ 'wr&qh' ORDER BY id <=| 400 LI QUERY PLAN --------------------------------------------------------- Limit + Disabled Nodes: 1 -> Sort + Disabled Nodes: 1 Sort Key: ((id <=| '400'::bigint)) -> Seq Scan on test_int8_a + Disabled Nodes: 1 Filter: (t @@ '''wr'' & ''qh'''::tsquery) -(5 rows) +(8 rows) SELECT id, id <=| 400 FROM test_int8_a WHERE t @@ 'wr&qh' ORDER BY id <=| 400 LIMIT 5; id | ?column? @@ -290,11 +298,14 @@ SELECT id, id |=> 400 FROM test_int8_a WHERE t @@ 'wr&qh' ORDER BY id |=> 400 LI QUERY PLAN --------------------------------------------------------- Limit + Disabled Nodes: 1 -> Sort + Disabled Nodes: 1 Sort Key: ((id |=> '400'::bigint)) -> Seq Scan on test_int8_a + Disabled Nodes: 1 Filter: (t @@ '''wr'' & ''qh'''::tsquery) -(5 rows) +(8 rows) SELECT id, id |=> 400 FROM test_int8_a WHERE t @@ 'wr&qh' ORDER BY id |=> 400 LIMIT 5; id | ?column? @@ -311,10 +322,12 @@ SELECT id FROM test_int8_a WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id; QUERY PLAN ------------------------------------------------------------------------------- Sort + Disabled Nodes: 1 Sort Key: id -> Seq Scan on test_int8_a + Disabled Nodes: 1 Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::bigint)) -(4 rows) +(6 rows) SELECT id FROM test_int8_a WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id; id @@ -336,10 +349,12 @@ SELECT id FROM test_int8_a WHERE t @@ 'wr&qh' AND id >= 400::int8 ORDER BY id; QUERY PLAN ------------------------------------------------------------------------------- Sort + Disabled Nodes: 1 Sort Key: id -> Seq Scan on test_int8_a + Disabled Nodes: 1 Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::bigint)) -(4 rows) +(6 rows) SELECT id FROM test_int8_a WHERE t @@ 'wr&qh' AND id >= 400::int8 ORDER BY id; id @@ -514,9 +529,11 @@ SELECT count(*) FROM test_int8_h_a WHERE id < 400::int8; QUERY PLAN -------------------------------------- Aggregate + Disabled Nodes: 1 -> Seq Scan on test_int8_h_a + Disabled Nodes: 1 Filter: (id < '400'::bigint) -(3 rows) +(5 rows) SELECT count(*) FROM test_int8_h_a WHERE id < 400::int8; count @@ -529,11 +546,14 @@ SELECT id, id <=> 400 FROM test_int8_h_a WHERE t @@ 'wr&qh' ORDER BY id <=> 400 QUERY PLAN --------------------------------------------------------- Limit + Disabled Nodes: 1 -> Sort + Disabled Nodes: 1 Sort Key: ((id <=> '400'::bigint)) -> Seq Scan on test_int8_h_a + Disabled Nodes: 1 Filter: (t @@ '''wr'' & ''qh'''::tsquery) -(5 rows) +(8 rows) SELECT id, id <=> 400 FROM test_int8_h_a WHERE t @@ 'wr&qh' ORDER BY id <=> 400 LIMIT 5; id | ?column? @@ -550,11 +570,14 @@ SELECT id, id <=| 400 FROM test_int8_h_a WHERE t @@ 'wr&qh' ORDER BY id <=| 400 QUERY PLAN --------------------------------------------------------- Limit + Disabled Nodes: 1 -> Sort + Disabled Nodes: 1 Sort Key: ((id <=| '400'::bigint)) -> Seq Scan on test_int8_h_a + Disabled Nodes: 1 Filter: (t @@ '''wr'' & ''qh'''::tsquery) -(5 rows) +(8 rows) SELECT id, id <=| 400 FROM test_int8_h_a WHERE t @@ 'wr&qh' ORDER BY id <=| 400 LIMIT 5; id | ?column? @@ -571,11 +594,14 @@ SELECT id, id |=> 400 FROM test_int8_h_a WHERE t @@ 'wr&qh' ORDER BY id |=> 400 QUERY PLAN --------------------------------------------------------- Limit + Disabled Nodes: 1 -> Sort + Disabled Nodes: 1 Sort Key: ((id |=> '400'::bigint)) -> Seq Scan on test_int8_h_a + Disabled Nodes: 1 Filter: (t @@ '''wr'' & ''qh'''::tsquery) -(5 rows) +(8 rows) SELECT id, id |=> 400 FROM test_int8_h_a WHERE t @@ 'wr&qh' ORDER BY id |=> 400 LIMIT 5; id | ?column? @@ -592,10 +618,12 @@ SELECT id FROM test_int8_h_a WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id QUERY PLAN ------------------------------------------------------------------------------- Sort + Disabled Nodes: 1 Sort Key: id -> Seq Scan on test_int8_h_a + Disabled Nodes: 1 Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::bigint)) -(4 rows) +(6 rows) SELECT id FROM test_int8_h_a WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id; id @@ -617,10 +645,12 @@ SELECT id FROM test_int8_h_a WHERE t @@ 'wr&qh' AND id >= 400::int8 ORDER BY id QUERY PLAN ------------------------------------------------------------------------------- Sort + Disabled Nodes: 1 Sort Key: id -> Seq Scan on test_int8_h_a + Disabled Nodes: 1 Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::bigint)) -(4 rows) +(6 rows) SELECT id FROM test_int8_h_a WHERE t @@ 'wr&qh' AND id >= 400::int8 ORDER BY id; id @@ -642,10 +672,12 @@ SELECT id FROM test_int8_h_a WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id QUERY PLAN ------------------------------------------------------------------------------- Sort + Disabled Nodes: 1 Sort Key: ((id <=> '400'::bigint)) -> Seq Scan on test_int8_h_a + Disabled Nodes: 1 Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::bigint)) -(4 rows) +(6 rows) SELECT id FROM test_int8_h_a WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id <=> 400::int8; id diff --git a/expected/orderby.out b/expected/orderby.out index 07ae7322ed..0b261292bd 100644 --- a/expected/orderby.out +++ b/expected/orderby.out @@ -194,12 +194,16 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY EXPLAIN (costs off) SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; - QUERY PLAN ------------------------------------------------------------------------------------ + QUERY PLAN +------------------------------------------------------------------------------------- Limit - -> Index Scan using tsts_idx on tsts - Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone) -(3 rows) + Disabled Nodes: 1 + -> Sort + Disabled Nodes: 1 + Sort Key: ((d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)) + -> Seq Scan on tsts + Disabled Nodes: 1 +(7 rows) SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; id | d | ?column? diff --git a/expected/orderby_1.out b/expected/orderby_1.out index cdd536ac9d..de69429862 100644 --- a/expected/orderby_1.out +++ b/expected/orderby_1.out @@ -194,15 +194,27 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY EXPLAIN (costs off) SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; - QUERY PLAN ------------------------------------------------------------------------------------ + QUERY PLAN +------------------------------------------------------------------------------------- Limit - -> Index Scan using tsts_idx on tsts - Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone) -(3 rows) + Disabled Nodes: 1 + -> Sort + Disabled Nodes: 1 + Sort Key: ((d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)) + -> Seq Scan on tsts + Disabled Nodes: 1 +(7 rows) SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; -ERROR: doesn't support order by over pass-by-reference column + id | d | ?column? +-----+---------------------------------+------------- + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 356 | Mon May 16 15:21:22.326724 2016 | 3597.326724 + 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276 + 357 | Mon May 16 16:21:22.326724 2016 | 7197.326724 + 353 | Mon May 16 12:21:22.326724 2016 | 7202.673276 +(5 rows) + EXPLAIN (costs off) SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; QUERY PLAN diff --git a/expected/orderby_hash.out b/expected/orderby_hash.out index 782ad5700e..974d356701 100644 --- a/expected/orderby_hash.out +++ b/expected/orderby_hash.out @@ -194,12 +194,16 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY EXPLAIN (costs off) SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; - QUERY PLAN ------------------------------------------------------------------------------------ + QUERY PLAN +------------------------------------------------------------------------------------- Limit - -> Index Scan using tstsh_idx on tstsh - Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone) -(3 rows) + Disabled Nodes: 1 + -> Sort + Disabled Nodes: 1 + Sort Key: ((d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)) + -> Seq Scan on tstsh + Disabled Nodes: 1 +(7 rows) SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; id | d | ?column? diff --git a/expected/orderby_hash_1.out b/expected/orderby_hash_1.out index f19e4507c7..52fab087cb 100644 --- a/expected/orderby_hash_1.out +++ b/expected/orderby_hash_1.out @@ -194,15 +194,27 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY EXPLAIN (costs off) SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; - QUERY PLAN ------------------------------------------------------------------------------------ + QUERY PLAN +------------------------------------------------------------------------------------- Limit - -> Index Scan using tstsh_idx on tstsh - Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone) -(3 rows) + Disabled Nodes: 1 + -> Sort + Disabled Nodes: 1 + Sort Key: ((d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)) + -> Seq Scan on tstsh + Disabled Nodes: 1 +(7 rows) SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; -ERROR: doesn't support order by over pass-by-reference column + id | d | ?column? +-----+---------------------------------+------------- + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 356 | Mon May 16 15:21:22.326724 2016 | 3597.326724 + 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276 + 357 | Mon May 16 16:21:22.326724 2016 | 7197.326724 + 353 | Mon May 16 12:21:22.326724 2016 | 7202.673276 +(5 rows) + EXPLAIN (costs off) SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; QUERY PLAN diff --git a/expected/rum.out b/expected/rum.out index 5966d196fe..d51159b997 100644 --- a/expected/rum.out +++ b/expected/rum.out @@ -163,6 +163,7 @@ SELECT rum_ts_distance(a, to_tsquery('pg_catalog.english', 'way & (go | half)'))::numeric(10,4), * FROM test_rum + WHERE a @@ to_tsquery('pg_catalog.english', 'way & (go | half)') ORDER BY a <=> to_tsquery('pg_catalog.english', 'way & (go | half)') limit 2; distance | rum_ts_distance | t | a ----------+-----------------+---------------------------------------------------------------------+--------------------------------------------------------- diff --git a/expected/rum_hash.out b/expected/rum_hash.out index 43a9760a28..caa6f44185 100644 --- a/expected/rum_hash.out +++ b/expected/rum_hash.out @@ -150,6 +150,7 @@ SELECT rum_ts_score(a, to_tsquery('pg_catalog.english', 'way & (go | half)'))::numeric(10,6), * FROM test_rum_hash + WHERE a @@ to_tsquery('pg_catalog.english', 'way & (go | half)') ORDER BY a <=> to_tsquery('pg_catalog.english', 'way & (go | half)') limit 2; distance | rum_ts_distance | rum_ts_score | t | a ----------+-----------------+--------------+---------------------------------------------------------------------+--------------------------------------------------------- diff --git a/expected/text.out b/expected/text.out index 9cf9310a77..716c877c70 100644 --- a/expected/text.out +++ b/expected/text.out @@ -135,9 +135,11 @@ SELECT count(*) FROM test_text_a WHERE id < '400'; QUERY PLAN ------------------------------------ Aggregate + Disabled Nodes: 1 -> Seq Scan on test_text_a + Disabled Nodes: 1 Filter: (id < '400'::text) -(3 rows) +(5 rows) SELECT count(*) FROM test_text_a WHERE id < '400'; count @@ -150,10 +152,12 @@ SELECT id FROM test_text_a WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id; QUERY PLAN ----------------------------------------------------------------------------- Sort + Disabled Nodes: 1 Sort Key: id -> Seq Scan on test_text_a + Disabled Nodes: 1 Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::text)) -(4 rows) +(6 rows) SELECT id FROM test_text_a WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id; id @@ -174,10 +178,12 @@ SELECT id FROM test_text_a WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id; QUERY PLAN ----------------------------------------------------------------------------- Sort + Disabled Nodes: 1 Sort Key: id -> Seq Scan on test_text_a + Disabled Nodes: 1 Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::text)) -(4 rows) +(6 rows) SELECT id FROM test_text_a WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id; id @@ -254,9 +260,11 @@ SELECT count(*) FROM test_text_h_a WHERE id < '400'; QUERY PLAN ------------------------------------ Aggregate + Disabled Nodes: 1 -> Seq Scan on test_text_h_a + Disabled Nodes: 1 Filter: (id < '400'::text) -(3 rows) +(5 rows) SELECT count(*) FROM test_text_h_a WHERE id < '400'; count @@ -269,10 +277,12 @@ SELECT id FROM test_text_h_a WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id; QUERY PLAN ----------------------------------------------------------------------------- Sort + Disabled Nodes: 1 Sort Key: id -> Seq Scan on test_text_h_a + Disabled Nodes: 1 Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::text)) -(4 rows) +(6 rows) SELECT id FROM test_text_h_a WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id; id @@ -293,10 +303,12 @@ SELECT id FROM test_text_h_a WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id; QUERY PLAN ----------------------------------------------------------------------------- Sort + Disabled Nodes: 1 Sort Key: id -> Seq Scan on test_text_h_a + Disabled Nodes: 1 Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::text)) -(4 rows) +(6 rows) SELECT id FROM test_text_h_a WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id; id diff --git a/sql/rum.sql b/sql/rum.sql index 8414bb95c5..dc02b22ddd 100644 --- a/sql/rum.sql +++ b/sql/rum.sql @@ -64,6 +64,7 @@ SELECT rum_ts_distance(a, to_tsquery('pg_catalog.english', 'way & (go | half)'))::numeric(10,4), * FROM test_rum + WHERE a @@ to_tsquery('pg_catalog.english', 'way & (go | half)') ORDER BY a <=> to_tsquery('pg_catalog.english', 'way & (go | half)') limit 2; -- Check ranking normalization diff --git a/sql/rum_hash.sql b/sql/rum_hash.sql index a33b8fde31..a431e2d130 100644 --- a/sql/rum_hash.sql +++ b/sql/rum_hash.sql @@ -53,6 +53,7 @@ SELECT rum_ts_score(a, to_tsquery('pg_catalog.english', 'way & (go | half)'))::numeric(10,6), * FROM test_rum_hash + WHERE a @@ to_tsquery('pg_catalog.english', 'way & (go | half)') ORDER BY a <=> to_tsquery('pg_catalog.english', 'way & (go | half)') limit 2; -- Check ranking normalization