CREATE TABLE rand_unlimited_10m_8 (key UInt8) Engine = Memory
CREATE TABLE rand_1k_10m_16 (key UInt16) Engine = Memory
CREATE TABLE rand_100k_10m_16 (key UInt16) Engine = Memory
CREATE TABLE rand_unlimited_10m_16 (key UInt16) Engine = Memory
CREATE TABLE rand_1k_10m_32 (key UInt32) Engine = Memory
CREATE TABLE rand_100k_10m_32 (key UInt32) Engine = Memory
CREATE TABLE rand_unlimited_10m_32 (key UInt32) Engine = Memory
CREATE TABLE rand_1k_10m_64 (key UInt64) Engine = Memory
CREATE TABLE rand_100k_10m_64 (key UInt64) Engine = Memory
CREATE TABLE rand_unlimited_10m_64 (key UInt64) Engine = Memory
INSERT INTO rand_unlimited_10m_8 SELECT rand() AS x FROM zeros(10000000)
INSERT INTO rand_1k_10m_16 SELECT rand()%1000 AS x FROM zeros(10000000)
INSERT INTO rand_100k_10m_16 SELECT rand()%100000 AS x FROM zeros(10000000)
INSERT INTO rand_unlimited_10m_16 SELECT rand() AS x FROM zeros(10000000)
INSERT INTO rand_1k_10m_32 SELECT rand()%1000 AS x FROM zeros(10000000)
INSERT INTO rand_100k_10m_32 SELECT rand()%100000 AS x FROM zeros(10000000)
INSERT INTO rand_unlimited_10m_32 SELECT rand() AS x FROM zeros(10000000)
INSERT INTO rand_1k_10m_64 SELECT rand()%1000 AS x FROM zeros(10000000)
INSERT INTO rand_100k_10m_64 SELECT rand()%100000 AS x FROM zeros(10000000)
INSERT INTO rand_unlimited_10m_64 SELECT rand() AS x FROM zeros(10000000)
SELECT sum(key) FROM (SELECT * FROM rand_unlimited_10m_8 ORDER BY key)
SELECT sum(key) FROM (SELECT * FROM rand_1k_10m_16 ORDER BY key)
SELECT sum(key) FROM (SELECT * FROM rand_100k_10m_16 ORDER BY key)
SELECT sum(key) FROM (SELECT * FROM rand_unlimited_10m_16 ORDER BY key)
SELECT sum(key) FROM (SELECT * FROM rand_1k_10m_32 ORDER BY key)
SELECT sum(key) FROM (SELECT * FROM rand_100k_10m_32 ORDER BY key)
SELECT sum(key) FROM (SELECT * FROM rand_unlimited_10m_32 ORDER BY key)
SELECT sum(key) FROM (SELECT * FROM rand_1k_10m_64 ORDER BY key)
SELECT sum(key) FROM (SELECT * FROM rand_100k_10m_64 ORDER BY key)
SELECT sum(key) FROM (SELECT * FROM rand_unlimited_10m_64 ORDER BY key)
DROP TABLE IF EXISTS rand_unlimited_10m_8
DROP TABLE IF EXISTS rand_1k_10m_16
DROP TABLE IF EXISTS rand_100k_10m_16
DROP TABLE IF EXISTS rand_unlimited_10m_16
DROP TABLE IF EXISTS rand_1k_10m_32
DROP TABLE IF EXISTS rand_100k_10m_32
DROP TABLE IF EXISTS rand_unlimited_10m_32
DROP TABLE IF EXISTS rand_1k_10m_64
DROP TABLE IF EXISTS rand_100k_10m_64
DROP TABLE IF EXISTS rand_unlimited_10m_64