2019-06-03 17:36:27 +00:00
|
|
|
drop table if exists test1_00863;
|
|
|
|
drop table if exists test2_00863;
|
|
|
|
drop table if exists test3_00863;
|
2019-05-23 16:01:17 +00:00
|
|
|
|
2019-06-03 17:36:27 +00:00
|
|
|
create table test1_00863 (id UInt64, code String) engine = Memory;
|
|
|
|
create table test3_00863 (id UInt64, code String) engine = Memory;
|
|
|
|
create table test2_00863 (id UInt64, code String, test1_id UInt64, test3_id UInt64) engine = Memory;
|
2019-05-23 16:01:17 +00:00
|
|
|
|
2019-06-03 17:36:27 +00:00
|
|
|
insert into test1_00863 (id, code) select number, toString(number) FROM numbers(100000);
|
|
|
|
insert into test3_00863 (id, code) select number, toString(number) FROM numbers(100000);
|
|
|
|
insert into test2_00863 (id, code, test1_id, test3_id) select number, toString(number), number, number FROM numbers(100000);
|
2019-05-23 16:01:17 +00:00
|
|
|
|
2020-02-20 13:33:14 +00:00
|
|
|
SET max_memory_usage = 50000000;
|
|
|
|
|
2019-06-03 17:36:27 +00:00
|
|
|
select test2_00863.id
|
|
|
|
from test1_00863, test2_00863, test3_00863
|
|
|
|
where test1_00863.code in ('1', '2', '3')
|
|
|
|
and test2_00863.test1_id = test1_00863.id
|
|
|
|
and test2_00863.test3_id = test3_00863.id;
|
2019-05-23 16:01:17 +00:00
|
|
|
|
2019-06-03 17:36:27 +00:00
|
|
|
drop table test1_00863;
|
|
|
|
drop table test2_00863;
|
|
|
|
drop table test3_00863;
|