cloudberry icon indicating copy to clipboard operation
cloudberry copied to clipboard

Support SELECT FETCH WITH TIES in ORCA

Open my-ship-it opened this issue 2 years ago • 0 comments

create table t11(a int, b int);
insert into t11 select i%3, i from generate_series(1,15)i;

gpadmin=# set optimizer=off;
SET
gpadmin=# select * from t11 order by a fetch first 2 rows with ties;
 a | b
---+----
 0 | 15
 0 |  3
 0 |  6
 0 |  9
 0 | 12
(5 rows)

gpadmin=# set optimizer=on;
SET
gpadmin=# select * from t11 order by a fetch first 2 rows with ties;
 a | b
---+----
 0 | 15
 0 |  3
(2 rows)

https://www.jooq.org/doc/latest/manual/sql-building/sql-statements/select-statement/with-ties-clause/

my-ship-it avatar Aug 08 '23 05:08 my-ship-it