aboutsummaryrefslogtreecommitdiff
path: root/src/test/regress/expected/cluster.out
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/regress/expected/cluster.out')
-rw-r--r--src/test/regress/expected/cluster.out36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index bc26846d6a4..4c8d834d7ab 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -438,10 +438,46 @@ select * from clstr_temp;
(2 rows)
drop table clstr_temp;
+RESET SESSION AUTHORIZATION;
+-- Test CLUSTER with external tuplesorting
+create table clstr_4 as select * from tenk1;
+create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
+-- ensure we don't use the index in CLUSTER nor the checking SELECTs
+set enable_indexscan = off;
+-- Use external sort that only ever uses quicksort to sort runs:
+set maintenance_work_mem = '1MB';
+set replacement_sort_tuples = 0;
+cluster clstr_4 using cluster_sort;
+select * from
+(select hundred, lag(hundred) over () as lhundred,
+ thousand, lag(thousand) over () as lthousand,
+ tenthous, lag(tenthous) over () as ltenthous from clstr_4) ss
+where row(hundred, thousand, tenthous) <= row(lhundred, lthousand, ltenthous);
+ hundred | lhundred | thousand | lthousand | tenthous | ltenthous
+---------+----------+----------+-----------+----------+-----------
+(0 rows)
+
+-- Replacement selection will now be forced. It should only produce a single
+-- run, due to the fact that input is found to be presorted:
+set replacement_sort_tuples = 150000;
+cluster clstr_4 using cluster_sort;
+select * from
+(select hundred, lag(hundred) over () as lhundred,
+ thousand, lag(thousand) over () as lthousand,
+ tenthous, lag(tenthous) over () as ltenthous from clstr_4) ss
+where row(hundred, thousand, tenthous) <= row(lhundred, lthousand, ltenthous);
+ hundred | lhundred | thousand | lthousand | tenthous | ltenthous
+---------+----------+----------+-----------+----------+-----------
+(0 rows)
+
+reset enable_indexscan;
+reset maintenance_work_mem;
+reset replacement_sort_tuples;
-- clean up
\c -
DROP TABLE clustertest;
DROP TABLE clstr_1;
DROP TABLE clstr_2;
DROP TABLE clstr_3;
+DROP TABLE clstr_4;
DROP USER clstr_user;