q702.sql

application/sql

Filename: q702.sql
Type: application/sql
Part: 1
Message: Re: Adding skip scan (including MDAM style range skip scan) to nbtree
drop table if exists t_1000000_1000_1_2;

create table t_1000000_1000_1_2 (id1 bigint, id2 bigint, val text);
insert into t_1000000_1000_1_2 select (pow(random(), 1) * 1000), (pow(random(), 1) * 1000), md5(i::text) from generate_series(1,1000000) s(i);
create index on t_1000000_1000_1_2 (id1, id2);
vacuum freeze t_1000000_1000_1_2;
checkpoint;

set max_parallel_workers_per_gather = 0;

explain (analyze, timing off, buffers off) select id1,id2 from t_1000000_1000_1_2 where NOT (id1 in (983, 851, 385, 22, 930, 544, 528, 147, 561, 607, 437, 903, 331, 997, 390, 730, 615, 882, 306, 295, 972, 946, 283, 598, 994, 109, 339, 363, 548, 637, 265, 485, 328, 522, 946, 916, 557, 714, 586, 40, 749, 295, 5, 319, 139, 332, 120, 959, 658, 397, 724, 226, 751, 687, 467, 47, 26, 184, 160, 235, 838, 205, 972, 431, 944, 551, 897, 885, 782, 726, 242, 962, 477, 153, 73, 757, 558, 20, 663, 544, 697, 502, 103, 32, 440, 910, 210, 212, 979, 316, 341, 537, 209, 290, 940, 933, 86, 632, 173, 150, 327, 159, 915, 235, 241, 591, 578, 453, 796, 369, 369, 895, 12, 838, 836, 129, 319, 120, 951, 604, 944, 366, 409, 252, 28, 916, 379, 240, 640, 711, 418, 420, 899, 195, 971, 315, 289, 141, 558, 899, 352, 445, 550, 926, 290, 865, 783, 221, 179, 506, 84, 221, 839, 198, 32, 939, 738, 10, 514, 376, 199, 123, 880, 414, 491, 705, 200, 86, 220, 955, 172, 508, 297, 535, 994, 342, 981, 899, 506, 700, 466, 314, 942, 238, 19, 467, 239, 787, 316, 338, 774, 695, 893, 561, 504, 921, 297, 73, 889, 613, 385, 467, 932, 174, 169, 836, 878, 251, 194, 999, 286, 483, 640)) AND (id2 = 997);