summaryrefslogtreecommitdiffstats
path: root/mysql-test/main/sum_distinct-big.result
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
commit3f619478f796eddbba6e39502fe941b285dd97b1 (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/main/sum_distinct-big.result
parentInitial commit. (diff)
downloadmariadb-upstream.tar.xz
mariadb-upstream.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/main/sum_distinct-big.result')
-rw-r--r--mysql-test/main/sum_distinct-big.result135
1 files changed, 135 insertions, 0 deletions
diff --git a/mysql-test/main/sum_distinct-big.result b/mysql-test/main/sum_distinct-big.result
new file mode 100644
index 00000000..086dd33f
--- /dev/null
+++ b/mysql-test/main/sum_distinct-big.result
@@ -0,0 +1,135 @@
+set @save_tmp_table_size=@@tmp_table_size;
+set @save_max_heap_table_size=@@max_heap_table_size;
+set default_storage_engine=MYISAM;
+CREATE TABLE t1 (id INTEGER);
+CREATE TABLE t2 (id INTEGER);
+INSERT INTO t1 SELECT b.seq FROM seq_1_to_128,seq_1_to_1024 b;
+SELECT AVG(DISTINCT id) FROM t1 GROUP BY id % 13;
+AVG(DISTINCT id)
+513.5000
+508.0000
+509.0000
+510.0000
+511.0000
+512.0000
+513.0000
+514.0000
+515.0000
+516.0000
+517.0000
+511.5000
+512.5000
+SELECT SUM(DISTINCT id)/COUNT(DISTINCT id) FROM t1 GROUP BY id % 13;
+SUM(DISTINCT id)/COUNT(DISTINCT id)
+513.5000
+508.0000
+509.0000
+510.0000
+511.0000
+512.0000
+513.0000
+514.0000
+515.0000
+516.0000
+517.0000
+511.5000
+512.5000
+INSERT INTO t1 SELECT b.seq FROM seq_1_to_128,seq_1025_to_16384 b;
+INSERT INTO t2 SELECT b.seq FROM seq_1_to_128 a,seq_1_to_16384 b
+ORDER by (a.seq*0+b.seq)*rand();
+SELECT SUM(DISTINCT id) sm FROM t1;
+sm
+134225920
+SELECT SUM(DISTINCT id) sm FROM t2;
+sm
+134225920
+SELECT SUM(DISTINCT id) sm FROM t1 group by id % 13;
+sm
+10327590
+10328851
+10330112
+10331373
+10332634
+10317510
+10318770
+10320030
+10321290
+10322550
+10323810
+10325070
+10326330
+SET max_heap_table_size=16384;
+SHOW variables LIKE 'max_heap_table_size';
+Variable_name Value
+max_heap_table_size 16384
+SELECT SUM(DISTINCT id) sm FROM t1;
+sm
+134225920
+SELECT SUM(DISTINCT id) sm FROM t2;
+sm
+134225920
+SELECT SUM(DISTINCT id) sm FROM t1 GROUP BY id % 13;
+sm
+10327590
+10328851
+10330112
+10331373
+10332634
+10317510
+10318770
+10320030
+10321290
+10322550
+10323810
+10325070
+10326330
+#
+# Bug mdev-4063: SUM(DISTINCT...) with small'max_heap_table_size
+# (bug #56927)
+#
+SET max_heap_table_size=default;
+INSERT INTO t1 SELECT b.seq FROM seq_1_to_128,seq_16385_to_32768 b;
+TRUNCATE t2;
+INSERT INTO t2 SELECT b.seq FROM seq_1_to_128 a,seq_1_to_32768 b
+ORDER BY (a.seq*0+b.seq)*rand();
+SELECT SUM(DISTINCT id) sm FROM t2;
+sm
+536887296
+SET max_heap_table_size=16384;
+SELECT SUM(DISTINCT id) sm FROM t2;
+sm
+536887296
+DROP TABLE t1;
+DROP TABLE t2;
+SET @@tmp_table_size=@save_tmp_table_size;
+SET @@max_heap_table_size=@save_max_heap_table_size;
+#
+# MDEV-4311: COUNT(DISTINCT...) requiring a file for UNIQUE (bug #68749)
+#
+CREATE TABLE t2 (id INTEGER) ENGINE=InnoDB;
+BEGIN;
+INSERT INTO t2 SELECT b.seq FROM seq_1_to_128 a, seq_1_to_16384 b
+ORDER BY b.seq*rand();
+INSERT INTO t2 VALUE(NULL);
+# With default tmp_table_size / max_heap_table_size
+SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
+sm
+16384
+set @@tmp_table_size=1024*256;
+# With reduced tmp_table_size
+SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
+sm
+16384
+set @@tmp_table_size=@save_tmp_table_size;
+SET @@max_heap_table_size=1024*256;
+# With reduced max_heap_table_size
+SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
+sm
+16384
+SET @@max_heap_table_size=@save_max_heap_table_size;
+# Back to default tmp_table_size / max_heap_table_size
+SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
+sm
+16384
+COMMIT;
+DROP TABLE t2;