set echo on; recreate table t_main(id int primary key); commit;
recreate table t_selected(id int primary key); commit; ------------------------------- insert into t_main(id) with recursive r as(select 0 i from rdb$database union all select i+1 from r where r.i<999) select n1.i*1000+n0.i from r n1,r n0 order by rand(); commit;
insert into t_selected(id) with recursive r as(select 0 i from rdb$database union all select i+1 from r where r.i<9) select n1.i*10+n0.i from r n1,r n0; commit;
set stat on; select count(*) from t_main where id in ( 1, 11, 21, 31, 41, 51, 61, 71, 81, 91, 2, 12, 22, 32, 42, 52, 62, 72, 82, 92, 3, 13, 23, 33, 43, 53, 63, 73, 83, 93, 4, 14, 24, 34, 44, 54, 64, 74, 84, 94, 5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 6, 16, 26, 36, 46, 56, 66, 76, 86, 96, 7, 17, 27, 37, 47, 57, 67, 77, 87, 97, 8, 18, 28, 38, 48, 58, 68, 78, 88, 98, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 );
select count(*) from t_main m join t_selected s on m.id=s.id; set stat off; commit;
/* результат на обычной рабочей станции: COUNT ============ 100
Current memory = 71909016 Delta memory = 187704 Max memory = 81663420 Elapsed time= 0.00 sec Buffers = 16384 Reads = 0 Writes 0 Fetches = 616
select count(*) from t_main m join t_selected s on m.id=s.id;
COUNT ============ 100
Current memory = 71731064 Delta memory = -177952 Max memory = 81663420 Elapsed time= 0.02 sec Buffers = 16384 Reads = 0 Writes 0 Fetches = 825 set stat off; commit; */ |