Skip to content

Commit

Permalink
[#22337] YSQL: Remove query plan costs from yb_index_scan regression …
Browse files Browse the repository at this point in the history
…tests

Summary:
These tests do not need costs in explain's output
Jira: DB-11242

Test Plan: ./yb_build.sh --java-test 'org.yb.pgsql.TestPgRegressIndex'

Reviewers: jason, myang, tnayak

Reviewed By: jason

Subscribers: yql

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D34927
  • Loading branch information
andrei-mart committed May 10, 2024
1 parent 03c07bd commit 79601b4
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 110 deletions.
176 changes: 88 additions & 88 deletions src/postgres/src/test/regress/expected/yb_index_scan.out
Expand Up @@ -338,10 +338,10 @@ SELECT * FROM sc_multi_desc WHERE k = 1;

-- Testing for the case in issue #12481
CREATE INDEX range_ind ON sc_multi_desc(v ASC, r ASC);
EXPLAIN SELECT v,r FROM sc_multi_desc WHERE v IN (2,4) and r is null;
QUERY PLAN
-------------------------------------------------------------------------------------
Index Only Scan using range_ind on sc_multi_desc (cost=0.00..5.12 rows=10 width=8)
EXPLAIN (COSTS OFF) SELECT v,r FROM sc_multi_desc WHERE v IN (2,4) and r is null;
QUERY PLAN
----------------------------------------------------------------
Index Only Scan using range_ind on sc_multi_desc
Index Cond: ((v = ANY ('{2,4}'::integer[])) AND (r IS NULL))
(2 rows)

Expand Down Expand Up @@ -553,16 +553,16 @@ select * from test;
3 | 3 | 3 | 3 | 3 | 3 | Cc | 3 | 99
(6 rows)

explain select * from test where col9 = 88;
QUERY PLAN
---------------------------------------------------------------------------
Index Scan using idx_col9 on test (cost=0.00..102.00 rows=1000 width=96)
EXPLAIN (COSTS OFF) SELECT * from test where col9 = 88;
QUERY PLAN
-----------------------------------
Index Scan using idx_col9 on test
(1 row)

explain select * from test where col9 = 99;
QUERY PLAN
----------------------------------------------------------
Seq Scan on test (cost=0.00..102.50 rows=1000 width=96)
EXPLAIN (COSTS OFF) SELECT * from test where col9 = 99;
QUERY PLAN
-------------------------------
Seq Scan on test
Storage Filter: (col9 = 99)
(2 rows)

Expand All @@ -582,17 +582,17 @@ select * from test where col9 = 99;

-- testing index on expressions
create index idx_col7 ON test(col7);
explain select * from test where col7 = 'Dd';
QUERY PLAN
-----------------------------------------------------------------------
Index Scan using idx_col7 on test (cost=0.00..5.22 rows=10 width=96)
EXPLAIN (COSTS OFF) SELECT * from test where col7 = 'Dd';
QUERY PLAN
-----------------------------------
Index Scan using idx_col7 on test
Index Cond: (col7 = 'Dd'::name)
(2 rows)

explain select * from test where lower(col7) = 'dd';
QUERY PLAN
----------------------------------------------------------
Seq Scan on test (cost=0.00..107.50 rows=1000 width=96)
EXPLAIN (COSTS OFF) SELECT * from test where lower(col7) = 'dd';
QUERY PLAN
------------------------------------------------------
Seq Scan on test
Storage Filter: (lower((col7)::text) = 'dd'::text)
(2 rows)

Expand All @@ -605,10 +605,10 @@ select * from test where col7 = 'Dd';
drop index idx_col7;
create index idx_col7 ON test(lower(col7));
update test set col7='DdD' where pk=4;
explain select * from test where lower(col7) = lower('DdD');
QUERY PLAN
-----------------------------------------------------------------------
Index Scan using idx_col7 on test (cost=0.00..5.27 rows=10 width=96)
EXPLAIN (COSTS OFF) SELECT * from test where lower(col7) = lower('DdD');
QUERY PLAN
---------------------------------------------------
Index Scan using idx_col7 on test
Index Cond: (lower((col7)::text) = 'ddd'::text)
(2 rows)

Expand All @@ -632,10 +632,10 @@ select * from test where lower(col7) = lower('DdD');
-- testing multi-column indices
create index idx_col4_idx_col5_idx_col6 on test(col4, col5, col6);
update test set col4=112 where pk=1;
EXPLAIN SELECT * FROM test WHERE col4 = 112;
QUERY PLAN
-------------------------------------------------------------------------------------------
Index Scan using idx_col4_idx_col5_idx_col6 on test (cost=0.00..16.25 rows=100 width=96)
EXPLAIN (COSTS OFF) SELECT * FROM test WHERE col4 = 112;
QUERY PLAN
-----------------------------------------------------
Index Scan using idx_col4_idx_col5_idx_col6 on test
Index Cond: (col4 = 112)
(2 rows)

Expand All @@ -646,10 +646,10 @@ SELECT * FROM test WHERE col4 = 112;
(1 row)

update test set col4=222, col5=223 where pk=2;
EXPLAIN SELECT * FROM test WHERE col4 = 222 and col5 = 223;
QUERY PLAN
-----------------------------------------------------------------------
Index Scan using idx_col5 on test (cost=0.00..5.28 rows=10 width=96)
EXPLAIN (COSTS OFF) SELECT * FROM test WHERE col4 = 222 and col5 = 223;
QUERY PLAN
-----------------------------------
Index Scan using idx_col5 on test
Index Cond: (col5 = 223)
Storage Filter: (col4 = 222)
(3 rows)
Expand All @@ -661,10 +661,10 @@ SELECT * FROM test WHERE col4 = 222 and col5 = 223;
(1 row)

update test set col4=232, col5=345, col6=456 where pk=3;
EXPLAIN SELECT * FROM test WHERE col4 = 232 and col5 = 345 and col6 = 456;
QUERY PLAN
-----------------------------------------------------------------------------------------
Index Scan using idx_col4_idx_col5_idx_col6 on test (cost=0.00..5.27 rows=10 width=96)
EXPLAIN (COSTS OFF) SELECT * FROM test WHERE col4 = 232 and col5 = 345 and col6 = 456;
QUERY PLAN
----------------------------------------------------------------
Index Scan using idx_col4_idx_col5_idx_col6 on test
Index Cond: ((col4 = 232) AND (col5 = 345) AND (col6 = 456))
(2 rows)

Expand All @@ -674,10 +674,10 @@ SELECT * FROM test WHERE col4 = 232 and col5 = 345 and col6 = 456;
3 | 3 | 3 | 232 | 345 | 456 | Cc | 3 | 99
(1 row)

EXPLAIN SELECT * FROM test WHERE col5 = 345;
QUERY PLAN
-----------------------------------------------------------------------
Index Scan using idx_col5 on test (cost=0.00..5.22 rows=10 width=96)
EXPLAIN (COSTS OFF) SELECT * FROM test WHERE col5 = 345;
QUERY PLAN
-----------------------------------
Index Scan using idx_col5 on test
Index Cond: (col5 = 345)
(2 rows)

Expand All @@ -688,10 +688,10 @@ SELECT * FROM test WHERE col5 = 345;
(1 row)

update test set col5=444, col6=35 where pk=4;
EXPLAIN SELECT * FROM test WHERE col5 = 444 and col6 = 35;
QUERY PLAN
-----------------------------------------------------------------------
Index Scan using idx_col5 on test (cost=0.00..5.28 rows=10 width=96)
EXPLAIN (COSTS OFF) SELECT * FROM test WHERE col5 = 444 and col6 = 35;
QUERY PLAN
-------------------------------------
Index Scan using idx_col5 on test
Index Cond: (col5 = 444)
Storage Index Filter: (col6 = 35)
(3 rows)
Expand All @@ -703,10 +703,10 @@ SELECT * FROM test WHERE col5 = 444 and col6 = 35;
(1 row)

update test set col6=5554 where pk=5;
EXPLAIN SELECT * FROM test WHERE col6 = 5554;
QUERY PLAN
----------------------------------------------------------
Seq Scan on test (cost=0.00..102.50 rows=1000 width=96)
EXPLAIN (COSTS OFF) SELECT * FROM test WHERE col6 = 5554;
QUERY PLAN
---------------------------------
Seq Scan on test
Storage Filter: (col6 = 5554)
(2 rows)

Expand All @@ -718,10 +718,10 @@ SELECT * FROM test WHERE col6 = 5554;

-- test index only scan with non-target column refs in qual (github issue #9176)
-- baseline, col5 is in target columns
EXPLAIN SELECT col4, col5 FROM test WHERE col4 = 232 and col5 % 3 = 0;
QUERY PLAN
-----------------------------------------------------------------------------------------------
Index Only Scan using idx_col4_idx_col5_idx_col6 on test (cost=0.00..16.25 rows=100 width=8)
EXPLAIN (COSTS OFF) SELECT col4, col5 FROM test WHERE col4 = 232 and col5 % 3 = 0;
QUERY PLAN
----------------------------------------------------------
Index Only Scan using idx_col4_idx_col5_idx_col6 on test
Index Cond: (col4 = 232)
Storage Filter: ((col5 % 3) = 0)
(3 rows)
Expand All @@ -733,10 +733,10 @@ SELECT col4, col5 FROM test WHERE col4 = 232 and col5 % 3 = 0;
(1 row)

-- same lines are expected without col5 in the target list
EXPLAIN SELECT col4 FROM test WHERE col4 = 232 and col5 % 3 = 0;
QUERY PLAN
-----------------------------------------------------------------------------------------------
Index Only Scan using idx_col4_idx_col5_idx_col6 on test (cost=0.00..16.25 rows=100 width=4)
EXPLAIN (COSTS OFF) SELECT col4 FROM test WHERE col4 = 232 and col5 % 3 = 0;
QUERY PLAN
----------------------------------------------------------
Index Only Scan using idx_col4_idx_col5_idx_col6 on test
Index Cond: (col4 = 232)
Storage Filter: ((col5 % 3) = 0)
(3 rows)
Expand Down Expand Up @@ -812,10 +812,10 @@ select * from test;
25 | 2 | 2 | 777 | 223 | 2 | Bb | 2 | 199
(6 rows)

explain select * from test where pk=17;
QUERY PLAN
-----------------------------------------------------------------------
Index Scan using test_pkey on test (cost=0.00..4.11 rows=1 width=96)
EXPLAIN (COSTS OFF) SELECT * from test where pk=17;
QUERY PLAN
------------------------------------
Index Scan using test_pkey on test
Index Cond: (pk = 17)
(2 rows)

Expand All @@ -825,10 +825,10 @@ select * from test where pk=17;
17 | 1 | 11 | 112 | 1 | 1 | Aa | 1 | 99
(1 row)

explain select * from test where pk=25;
QUERY PLAN
-----------------------------------------------------------------------
Index Scan using test_pkey on test (cost=0.00..4.11 rows=1 width=96)
EXPLAIN (COSTS OFF) SELECT * from test where pk=25;
QUERY PLAN
------------------------------------
Index Scan using test_pkey on test
Index Cond: (pk = 25)
(2 rows)

Expand All @@ -841,10 +841,10 @@ select * from test where pk=25;
-- test index scan where the column type does not match value type
CREATE TABLE pk_real(c0 REAL, PRIMARY KEY(c0 asc));
INSERT INTO pk_real(c0) VALUES(0.4);
EXPLAIN SELECT ALL pk_real.c0 FROM pk_real WHERE ((0.6)>(pk_real.c0));
QUERY PLAN
----------------------------------------------------------------------------
Index Scan using pk_real_pkey on pk_real (cost=0.00..4.11 rows=1 width=4)
EXPLAIN (COSTS OFF) SELECT ALL pk_real.c0 FROM pk_real WHERE ((0.6)>(pk_real.c0));
QUERY PLAN
----------------------------------------------
Index Scan using pk_real_pkey on pk_real
Index Cond: ('0.6'::double precision > c0)
(2 rows)

Expand All @@ -854,10 +854,10 @@ SELECT ALL pk_real.c0 FROM pk_real WHERE ((0.6)>(pk_real.c0));
0.4
(1 row)

EXPLAIN SELECT ALL pk_real.c0 FROM pk_real WHERE pk_real.c0 = ANY(ARRAY[0.6, 0.4]);
QUERY PLAN
----------------------------------------------------------------------------
Index Scan using pk_real_pkey on pk_real (cost=0.00..4.11 rows=1 width=4)
EXPLAIN (COSTS OFF) SELECT ALL pk_real.c0 FROM pk_real WHERE pk_real.c0 = ANY(ARRAY[0.6, 0.4]);
QUERY PLAN
------------------------------------------------------------
Index Scan using pk_real_pkey on pk_real
Index Cond: (c0 = ANY ('{0.6,0.4}'::double precision[]))
(2 rows)

Expand All @@ -868,10 +868,10 @@ SELECT ALL pk_real.c0 FROM pk_real WHERE pk_real.c0 = ANY(ARRAY[0.6, 0.4]);
(0 rows)

INSERT INTO pk_real(c0) VALUES(0.5);
EXPLAIN SELECT ALL pk_real.c0 FROM pk_real WHERE pk_real.c0 = 0.5;
QUERY PLAN
----------------------------------------------------------------------------
Index Scan using pk_real_pkey on pk_real (cost=0.00..4.11 rows=1 width=4)
EXPLAIN (COSTS OFF) SELECT ALL pk_real.c0 FROM pk_real WHERE pk_real.c0 = 0.5;
QUERY PLAN
----------------------------------------------
Index Scan using pk_real_pkey on pk_real
Index Cond: (c0 = '0.5'::double precision)
(2 rows)

Expand All @@ -884,10 +884,10 @@ SELECT ALL pk_real.c0 FROM pk_real WHERE pk_real.c0 = 0.5;

CREATE TABLE pk_smallint(c0 SMALLINT, PRIMARY KEY(c0 asc));
INSERT INTO pk_smallint VALUES(123), (-123);
EXPLAIN SELECT c0 FROM pk_smallint WHERE (65568 > c0);
QUERY PLAN
------------------------------------------------------------------------------------
Index Scan using pk_smallint_pkey on pk_smallint (cost=0.00..4.11 rows=1 width=2)
EXPLAIN (COSTS OFF) SELECT c0 FROM pk_smallint WHERE (65568 > c0);
QUERY PLAN
--------------------------------------------------
Index Scan using pk_smallint_pkey on pk_smallint
Index Cond: (65568 > c0)
(2 rows)

Expand All @@ -898,10 +898,10 @@ SELECT c0 FROM pk_smallint WHERE (65568 > c0);
123
(2 rows)

EXPLAIN SELECT c0 FROM pk_smallint WHERE (c0 > -65539);
QUERY PLAN
------------------------------------------------------------------------------------
Index Scan using pk_smallint_pkey on pk_smallint (cost=0.00..4.11 rows=1 width=2)
EXPLAIN (COSTS OFF) SELECT c0 FROM pk_smallint WHERE (c0 > -65539);
QUERY PLAN
--------------------------------------------------
Index Scan using pk_smallint_pkey on pk_smallint
Index Cond: (c0 > '-65539'::integer)
(2 rows)

Expand All @@ -912,10 +912,10 @@ SELECT c0 FROM pk_smallint WHERE (c0 > -65539);
123
(2 rows)

EXPLAIN SELECT c0 FROM pk_smallint WHERE (c0 = ANY(ARRAY[-65539, 65568]));
QUERY PLAN
------------------------------------------------------------------------------------
Index Scan using pk_smallint_pkey on pk_smallint (cost=0.00..4.11 rows=1 width=2)
EXPLAIN (COSTS OFF) SELECT c0 FROM pk_smallint WHERE (c0 = ANY(ARRAY[-65539, 65568]));
QUERY PLAN
--------------------------------------------------------
Index Scan using pk_smallint_pkey on pk_smallint
Index Cond: (c0 = ANY ('{-65539,65568}'::integer[]))
(2 rows)

Expand Down

0 comments on commit 79601b4

Please sign in to comment.