import file=tpch_schema
----

import file=tpch_stats
----

# --------------------------------------------------
# Q8
# National Market Share
# Determines how the market share of a given nation within a given region has
# changed over two years for a given part type.
#
# The market share for a given nation within a given region is defined as the
# fraction of the revenue, the sum of [l_extendedprice * (1-l_discount)], from
# the products of a specified type in that region that was supplied by suppliers
# from the given nation. The query determines this for the years 1995 and 1996
# presented in this order.
#
# TODO:
#   1. Join ordering
#   2. Push down equivalent column comparisons
# --------------------------------------------------
save-tables database=tpch save-tables-prefix=q8
SELECT
    o_year,
    sum(CASE
        WHEN nation = 'BRAZIL'
            THEN volume
        ELSE 0
    END) / sum(volume) AS mkt_share
FROM (
    SELECT
        extract(year FROM o_orderdate) AS o_year,
        l_extendedprice * (1 - l_discount) AS volume,
        n2.n_name AS nation
    FROM
        part,
        supplier,
        lineitem,
        orders,
        customer,
        nation n1,
        nation n2,
        region
    WHERE
        p_partkey = l_partkey
        AND s_suppkey = l_suppkey
        AND l_orderkey = o_orderkey
        AND o_custkey = c_custkey
        AND c_nationkey = n1.n_nationkey
        AND n1.n_regionkey = r_regionkey
        AND r_name = 'AMERICA'
        AND s_nationkey = n2.n_nationkey
        AND o_orderdate BETWEEN DATE '1995-01-01' AND DATE '1996-12-31'
        AND p_type = 'ECONOMY ANODIZED STEEL'
    ) AS all_nations
GROUP BY
    o_year
ORDER BY
    o_year;
----
sort
 ├── save-table-name: q8_sort_1
 ├── columns: o_year:61(int) mkt_share:66(float)
 ├── side-effects
 ├── stats: [rows=717.329701, distinct(61)=717.329701, null(61)=0, distinct(66)=717.329701, null(66)=0]
 ├── key: (61)
 ├── fd: (61)-->(66)
 ├── ordering: +61
 └── project
      ├── save-table-name: q8_project_2
      ├── columns: mkt_share:66(float) o_year:61(int)
      ├── side-effects
      ├── stats: [rows=717.329701, distinct(61)=717.329701, null(61)=0, distinct(66)=717.329701, null(66)=0]
      ├── key: (61)
      ├── fd: (61)-->(66)
      ├── group-by
      │    ├── save-table-name: q8_group_by_3
      │    ├── columns: o_year:61(int) sum:64(float) sum:65(float)
      │    ├── grouping columns: o_year:61(int)
      │    ├── stats: [rows=717.329701, distinct(61)=717.329701, null(61)=0, distinct(64)=717.329701, null(64)=0, distinct(65)=717.329701, null(65)=0, distinct(64,65)=717.329701, null(64,65)=0]
      │    ├── key: (61)
      │    ├── fd: (61)-->(64,65)
      │    ├── project
      │    │    ├── save-table-name: q8_project_4
      │    │    ├── columns: column63:63(float) o_year:61(int) volume:62(float)
      │    │    ├── stats: [rows=2908.77768, distinct(61)=717.329701, null(61)=0, distinct(62)=2896.77415, null(62)=0, distinct(63)=2896.99622, null(63)=0]
      │    │    ├── project
      │    │    │    ├── save-table-name: q8_project_5
      │    │    │    ├── columns: o_year:61(int) volume:62(float) n2.n_name:55(char!null)
      │    │    │    ├── stats: [rows=2908.77768, distinct(55)=24.9055527, null(55)=0, distinct(61)=717.329701, null(61)=0, distinct(62)=2896.77415, null(62)=0, distinct(55,62)=2896.99622, null(55,62)=0]
      │    │    │    ├── inner-join (hash)
      │    │    │    │    ├── save-table-name: q8_inner_join_6
      │    │    │    │    ├── columns: p_partkey:1(int!null) p_type:5(varchar!null) s_suppkey:10(int!null) s_nationkey:13(int!null) l_orderkey:17(int!null) l_partkey:18(int!null) l_suppkey:19(int!null) l_extendedprice:22(float!null) l_discount:23(float!null) o_orderkey:33(int!null) o_custkey:34(int!null) o_orderdate:37(date!null) c_custkey:42(int!null) c_nationkey:45(int!null) n1.n_nationkey:50(int!null) n1.n_regionkey:52(int!null) n2.n_nationkey:54(int!null) n2.n_name:55(char!null) r_regionkey:58(int!null) r_name:59(char!null)
      │    │    │    │    ├── stats: [rows=2908.77768, distinct(1)=1333.31636, null(1)=0, distinct(5)=1, null(5)=0, distinct(10)=2521.1211, null(10)=0, distinct(13)=24.9055527, null(13)=0, distinct(17)=2891.95767, null(17)=0, distinct(18)=1333.31636, null(18)=0, distinct(19)=2521.1211, null(19)=0, distinct(22)=2894.81008, null(22)=0, distinct(23)=11, null(23)=0, distinct(33)=2891.95767, null(33)=0, distinct(34)=2865.55277, null(34)=0, distinct(37)=717.329701, null(37)=0, distinct(42)=2865.55277, null(42)=0, distinct(45)=24.9055527, null(45)=0, distinct(50)=24.9055527, null(50)=0, distinct(52)=1, null(52)=0, distinct(54)=24.9055527, null(54)=0, distinct(55)=24.9055527, null(55)=0, distinct(58)=1, null(58)=0, distinct(59)=1, null(59)=0, distinct(22,23)=2896.77415, null(22,23)=0, distinct(22,23,55)=2896.99622, null(22,23,55)=0]
      │    │    │    │    ├── fd: ()-->(5,59), (10)-->(13), (33)-->(34,37), (42)-->(45), (50)-->(52), (54)-->(55), (52)==(58), (58)==(52), (45)==(50), (50)==(45), (34)==(42), (42)==(34), (17)==(33), (33)==(17), (10)==(19), (19)==(10), (13)==(54), (54)==(13), (1)==(18), (18)==(1)
      │    │    │    │    ├── inner-join (hash)
      │    │    │    │    │    ├── save-table-name: q8_inner_join_7
      │    │    │    │    │    ├── columns: s_suppkey:10(int!null) s_nationkey:13(int!null) l_orderkey:17(int!null) l_partkey:18(int!null) l_suppkey:19(int!null) l_extendedprice:22(float!null) l_discount:23(float!null) o_orderkey:33(int!null) o_custkey:34(int!null) o_orderdate:37(date!null) c_custkey:42(int!null) c_nationkey:45(int!null) n1.n_nationkey:50(int!null) n1.n_regionkey:52(int!null) n2.n_nationkey:54(int!null) n2.n_name:55(char!null) r_regionkey:58(int!null) r_name:59(char!null)
      │    │    │    │    │    ├── stats: [rows=365109.988, distinct(10)=9920, null(10)=0, distinct(13)=24.9055527, null(13)=0, distinct(17)=250416.539, null(17)=0, distinct(18)=167360.098, null(18)=0, distinct(19)=9920, null(19)=0, distinct(22)=301722.135, null(22)=0, distinct(23)=11, null(23)=0, distinct(33)=250416.539, null(33)=0, distinct(34)=96880.5395, null(34)=0, distinct(37)=731, null(37)=0, distinct(42)=96880.5395, null(42)=0, distinct(45)=24.9055527, null(45)=0, distinct(50)=24.9055527, null(50)=0, distinct(52)=1, null(52)=0, distinct(54)=24.9055527, null(54)=0, distinct(55)=24.9055527, null(55)=0, distinct(58)=1, null(58)=0, distinct(59)=1, null(59)=0, distinct(22,23)=351214.3, null(22,23)=0, distinct(22,23,55)=357847.556, null(22,23,55)=0]
      │    │    │    │    │    ├── fd: ()-->(59), (10)-->(13), (33)-->(34,37), (42)-->(45), (50)-->(52), (54)-->(55), (52)==(58), (58)==(52), (45)==(50), (50)==(45), (34)==(42), (42)==(34), (17)==(33), (33)==(17), (10)==(19), (19)==(10), (13)==(54), (54)==(13)
      │    │    │    │    │    ├── inner-join (hash)
      │    │    │    │    │    │    ├── save-table-name: q8_inner_join_8
      │    │    │    │    │    │    ├── columns: l_orderkey:17(int!null) l_partkey:18(int!null) l_suppkey:19(int!null) l_extendedprice:22(float!null) l_discount:23(float!null) o_orderkey:33(int!null) o_custkey:34(int!null) o_orderdate:37(date!null) c_custkey:42(int!null) c_nationkey:45(int!null) n1.n_nationkey:50(int!null) n1.n_regionkey:52(int!null) n2.n_nationkey:54(int!null) n2.n_name:55(char!null) r_regionkey:58(int!null) r_name:59(char!null)
      │    │    │    │    │    │    ├── stats: [rows=9054727.7, distinct(17)=451700.52, null(17)=0, distinct(18)=199241, null(18)=0, distinct(19)=9920, null(19)=0, distinct(22)=925902.554, null(22)=0, distinct(23)=11, null(23)=0, distinct(33)=451700.52, null(33)=0, distinct(34)=99405.6121, null(34)=0, distinct(37)=731, null(37)=0, distinct(42)=99405.6121, null(42)=0, distinct(45)=24.9055527, null(45)=0, distinct(50)=24.9055527, null(50)=0, distinct(52)=1, null(52)=0, distinct(54)=24.9055527, null(54)=0, distinct(55)=24.9055527, null(55)=0, distinct(58)=1, null(58)=0, distinct(59)=1, null(59)=0, distinct(22,23)=4673916.46, null(22,23)=0, distinct(22,23,55)=9054727.7, null(22,23,55)=0]
      │    │    │    │    │    │    ├── fd: ()-->(59), (33)-->(34,37), (42)-->(45), (50)-->(52), (54)-->(55), (52)==(58), (58)==(52), (45)==(50), (50)==(45), (34)==(42), (42)==(34), (17)==(33), (33)==(17)
      │    │    │    │    │    │    ├── scan lineitem
      │    │    │    │    │    │    │    ├── save-table-name: q8_scan_9
      │    │    │    │    │    │    │    ├── columns: l_orderkey:17(int!null) l_partkey:18(int!null) l_suppkey:19(int!null) l_extendedprice:22(float!null) l_discount:23(float!null)
      │    │    │    │    │    │    │    └── stats: [rows=6001215, distinct(17)=1527270, null(17)=0, distinct(18)=199241, null(18)=0, distinct(19)=9920, null(19)=0, distinct(22)=925955, null(22)=0, distinct(23)=11, null(23)=0, distinct(22,23)=6001215, null(22,23)=0]
      │    │    │    │    │    │    │        histogram(17)=  0  600  29405   600   29405   600   29405   600   29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    29405    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600    30006    600
      │    │    │    │    │    │    │                      <--- 326 ------- 28929 ------- 50503 ------- 89793 ------- 115938 ------- 146944 ------- 176768 ------- 211201 ------- 237860 ------- 266885 ------- 297604 ------- 330021 ------- 365889 ------- 398951 ------- 426117 ------- 451328 ------- 472134 ------- 499590 ------- 529284 ------- 557254 ------- 589154 ------- 619394 ------- 642951 ------- 670113 ------- 692931 ------- 721157 ------- 751687 ------- 777766 ------- 804582 ------- 836740 ------- 868868 ------- 898912 ------- 922500 ------- 946403 ------- 984870 ------- 1007936 ------- 1030117 ------- 1062275 ------- 1093572 ------- 1120709 ------- 1150981 ------- 1182786 ------- 1206406 ------- 1234116 ------- 1260961 ------- 1290502 ------- 1329510 ------- 1355426 ------- 1381313 ------- 1409796 ------- 1445254 ------- 1479233 ------- 1504935 ------- 1531079 ------- 1559650 ------- 1583616 ------- 1617504 ------- 1655749 ------- 1685185 ------- 1718183 ------- 1747716 ------- 1772131 ------- 1802372 ------- 1833315 ------- 1862403 ------- 1897894 ------- 1922819 ------- 1954405 ------- 1979329 ------- 2009859 ------- 2041670 ------- 2070851 ------- 2093828 ------- 2127973 ------- 2167777 ------- 2194883 ------- 2227814 ------- 2262437 ------- 2296353 ------- 2321024 ------- 2346051 ------- 2376257 ------- 2404932 ------- 2446273 ------- 2474081 ------- 2504515 ------- 2535302 ------- 2561413 ------- 2592737 ------- 2616801 ------- 2646112 ------- 2676546 ------- 2702116 ------- 2732454 ------- 2765382 ------- 2799495 ------- 2828866 ------- 2868737 ------- 2910625 ------- 2938464 ------- 2963140 ------- 3003302 ------- 3043264 ------- 3069123 ------- 3095909 ------- 3126693 ------- 3160485 ------- 3196039 ------- 3229504 ------- 3259712 ------- 3286439 ------- 3318852 ------- 3346821 ------- 3370119 ------- 3395204 ------- 3425888 ------- 3448611 ------- 3476130 ------- 3502372 ------- 3529474 ------- 3556390 ------- 3583553 ------- 3612550 ------- 3647875 ------- 3679140 ------- 3702661 ------- 3738017 ------- 3778050 ------- 3806114 ------- 3839074 ------- 3872805 ------- 3905697 ------- 3926212 ------- 3959841 ------- 3997281 ------- 4033861 ------- 4063591 ------- 4097831 ------- 4124807 ------- 4158656 ------- 4195748 ------- 4234274 ------- 4269952 ------- 4298949 ------- 4332806 ------- 4364705 ------- 4398246 ------- 4430695 ------- 4466403 ------- 4494662 ------- 4524420 ------- 4558561 ------- 4601092 ------- 4632871 ------- 4658694 ------- 4690501 ------- 4728066 ------- 4758657 ------- 4788294 ------- 4818597 ------- 4855874 ------- 4890913 ------- 4915366 ------- 4940709 ------- 4972357 ------- 4995298 ------- 5019523 ------- 5043329 ------- 5077376 ------- 5109920 ------- 5136582 ------- 5161152 ------- 5191846 ------- 5219973 ------- 5251015 ------- 5282021 ------- 5312355 ------- 5343207 ------- 5381318 ------- 5416163 ------- 5445382 ------- 5476933 ------- 5509185 ------- 5539237 ------- 5566818 ------- 5588739 ------- 5620481 ------- 5644001 ------- 5667010 ------- 5689476 ------- 5724709 ------- 5755398 ------- 5790598 ------- 5819425 ------- 5846341 ------- 5874656 ------- 5908067 ------- 5933572 ------- 5962659 ------- 5999971
      │    │    │    │    │    │    │        histogram(18)=  0 600  29405  600  29405  600   29405  600   29405  600   29405  600   29405  1200  29405  600   29405  600   29405  600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405  1200   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   28805  1200   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   28805  1200   29405   600   29405   600   29405   600   29405   600   29405  1200   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600   29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   1200   29405   600    29405   600    29405   600    28805   1200   29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    28805   1200   29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    28805   1200   29405   600    29405   600    29405   600    29405   600    29405   600    29405   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   1200   29405   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600    30006   600
      │    │    │    │    │    │    │                      <--- 29 ------- 959 ------- 1845 ------- 3339 ------- 4395 ------- 5525 ------- 6349 ------- 7298 ------- 8340 ------- 9659 ------- 10756 ------- 11642 ------- 12662 ------- 13609 ------- 14663 ------- 15886 ------- 16905 ------- 17902 ------- 18705 ------- 19722 ------- 20827 ------- 21789 ------- 23026 ------- 24201 ------- 25338 ------- 26224 ------- 27182 ------- 28202 ------- 29058 ------- 29919 ------- 31031 ------- 32058 ------- 33058 ------- 34089 ------- 34972 ------- 35929 ------- 36995 ------- 37901 ------- 38814 ------- 39884 ------- 41044 ------- 42034 ------- 43257 ------- 44224 ------- 45196 ------- 46284 ------- 47373 ------- 48352 ------- 49175 ------- 50212 ------- 51359 ------- 52449 ------- 53225 ------- 54295 ------- 55556 ------- 56736 ------- 57984 ------- 59102 ------- 60117 ------- 61111 ------- 62007 ------- 63054 ------- 63923 ------- 64971 ------- 66018 ------- 67114 ------- 67979 ------- 69163 ------- 70178 ------- 71421 ------- 72412 ------- 73432 ------- 74444 ------- 75421 ------- 76307 ------- 77194 ------- 78249 ------- 79229 ------- 80220 ------- 81103 ------- 81841 ------- 83133 ------- 84398 ------- 85526 ------- 86382 ------- 87333 ------- 88313 ------- 89185 ------- 90240 ------- 91121 ------- 91927 ------- 92840 ------- 93562 ------- 94443 ------- 95372 ------- 96282 ------- 97084 ------- 97969 ------- 99105 ------- 100036 ------- 100911 ------- 101928 ------- 102725 ------- 103625 ------- 104599 ------- 105568 ------- 106366 ------- 107318 ------- 108221 ------- 109084 ------- 110150 ------- 111130 ------- 112290 ------- 113258 ------- 114514 ------- 115361 ------- 116860 ------- 118141 ------- 119083 ------- 120205 ------- 121265 ------- 122280 ------- 123210 ------- 124316 ------- 125393 ------- 126419 ------- 127466 ------- 128467 ------- 129550 ------- 130729 ------- 131956 ------- 133065 ------- 134173 ------- 135106 ------- 136339 ------- 137237 ------- 138221 ------- 139139 ------- 140103 ------- 141250 ------- 142059 ------- 142984 ------- 144048 ------- 145243 ------- 146186 ------- 147153 ------- 148099 ------- 149103 ------- 149945 ------- 150918 ------- 151860 ------- 152830 ------- 153863 ------- 154681 ------- 156041 ------- 156862 ------- 157688 ------- 158743 ------- 159676 ------- 160684 ------- 161325 ------- 162394 ------- 163558 ------- 164576 ------- 165819 ------- 166748 ------- 167734 ------- 168986 ------- 170087 ------- 170931 ------- 171933 ------- 172836 ------- 174038 ------- 175011 ------- 175836 ------- 176680 ------- 177741 ------- 178899 ------- 179745 ------- 180631 ------- 181664 ------- 182624 ------- 183639 ------- 184414 ------- 185145 ------- 186261 ------- 187090 ------- 188033 ------- 189049 ------- 190063 ------- 191040 ------- 192115 ------- 193408 ------- 194360 ------- 195506 ------- 196582 ------- 197367 ------- 198465 ------- 199096 ------- 199970
      │    │    │    │    │    │    │        histogram(19)=  0 600 28805 3000 29405  600  29405  600  29405  600  29405  600  29405 1200  29405 1200  29405 1200  28805 1200  28805 1800  29405  600  29405 1200  29405  600  29405  600  28805 1200  29405 1200  28805 1200  28205 1800  29405 1200  29405  600   29405  1200  29405  1200  29405  600   29405  1200  29405  1200  28805  1800  29405  600   28805  1800  28805  1200  28805  1200  29405  1200  28805  1800  29405  600   28205  1800  29405  600   29405  600   28805  1200  29405  600   28805  1200  29405  600   29405  600   28805  1200  28805  1800  27605  2400  29405  600   28205  1800  29405  2400  29405  600   28805  1800  28205  1800  28805  1200  29405  3000  29405  1200  29405  1800  29405  600   29405  600   28205  1800  29405  600   29405  1800  29405  1800  29405  600   29405  600   28805  1200  28805  1200  29405  1200  28205  1800  29405  600   28805  1200  27605  2400  29405  600   29405  1200  29405  1200  29405  600   29405  1800  29405  1200  28205  1800  29405  600   29405  1200  29405  1200  28805  1200  28205  1800  29405  1800  28805  1200  29405  600   29405  1800  28205  2400  29405  600   28805  1200  28205  2400  28805  1200  27605  2400  28805  1200  29405  600   28805  1800  29405  1800  28805  600   28205  1800  28805  600   29405  600   29405  1200  28805  600   28805  1200  29405  1800  27605  1800  27605  2400  27605  1800  29405  1200  28805  600   28805  1200  29405  1200  28805  2400  28805  1200  28805  600   28205  1200  28205  1200  29405  600   28805  1200  29405  600   28205  2400  28205  1200  29405  600   29405  1800  28805  1200  28205  1200  27605  2400  27605  1800  28805  1200  29405  600   28805  1200  29405  600   29405  600   28805  1200  29405  600   29405  600   29405  600   28805  1200  29405  1200  28805  600   29405  1800  28205  1200  27605  1800  29405  600   29405  600   29405  1200  28805  1200  28805  1200  28205  1200  29405  1800  28205  1800  28805  600   28805  1200  28205  1200  29405  600   28805  1800  28205  1800  27605  2400  28805  600   29405  600   28805  1200  29405  600   28805  2400  28805  1200  28805  1200  28805  600   28205  1200  28805  1200  29405  600   29405  600   29405  1800  28805  600   28805  600   28805  2400  28805  600   28805  1800  28805  1200  28805  600   27005  2400  29405  600   28205  1800  29405  1200  27605  1800  28805  1200  28805  1200  29405  600   29405  600   29405  600   29405  1200  28805  600   29405  600   27605  2400  28805  1200  29405  600   28805  1800  28805  1800  28205  1200  28805  1200  28805  600   29405  1200  28205  1200
      │    │    │    │    │    │    │                      <--- 6 ------- 59 ------- 106 ------- 147 ------- 189 ------- 219 ------- 272 ------- 335 ------- 387 ------- 433 ------- 485 ------- 539 ------- 600 ------- 653 ------- 698 ------- 749 ------- 806 ------- 855 ------- 904 ------- 961 ------- 1008 ------- 1065 ------- 1115 ------- 1163 ------- 1212 ------- 1270 ------- 1329 ------- 1373 ------- 1417 ------- 1470 ------- 1514 ------- 1566 ------- 1616 ------- 1668 ------- 1719 ------- 1765 ------- 1819 ------- 1871 ------- 1926 ------- 1978 ------- 2030 ------- 2080 ------- 2128 ------- 2173 ------- 2223 ------- 2270 ------- 2318 ------- 2382 ------- 2444 ------- 2491 ------- 2534 ------- 2584 ------- 2632 ------- 2675 ------- 2736 ------- 2781 ------- 2841 ------- 2905 ------- 2940 ------- 2996 ------- 3045 ------- 3084 ------- 3124 ------- 3181 ------- 3224 ------- 3268 ------- 3318 ------- 3362 ------- 3419 ------- 3466 ------- 3515 ------- 3560 ------- 3615 ------- 3669 ------- 3725 ------- 3777 ------- 3825 ------- 3871 ------- 3923 ------- 3980 ------- 4035 ------- 4078 ------- 4135 ------- 4184 ------- 4244 ------- 4296 ------- 4346 ------- 4396 ------- 4444 ------- 4489 ------- 4540 ------- 4575 ------- 4627 ------- 4683 ------- 4731 ------- 4777 ------- 4831 ------- 4900 ------- 4953 ------- 5006 ------- 5061 ------- 5119 ------- 5161 ------- 5208 ------- 5260 ------- 5315 ------- 5361 ------- 5415 ------- 5474 ------- 5529 ------- 5572 ------- 5635 ------- 5689 ------- 5738 ------- 5792 ------- 5835 ------- 5890 ------- 5935 ------- 5997 ------- 6039 ------- 6094 ------- 6151 ------- 6201 ------- 6245 ------- 6291 ------- 6343 ------- 6387 ------- 6437 ------- 6480 ------- 6540 ------- 6580 ------- 6629 ------- 6673 ------- 6718 ------- 6771 ------- 6823 ------- 6878 ------- 6935 ------- 6974 ------- 7017 ------- 7060 ------- 7112 ------- 7170 ------- 7231 ------- 7279 ------- 7329 ------- 7373 ------- 7427 ------- 7477 ------- 7520 ------- 7564 ------- 7616 ------- 7671 ------- 7716 ------- 7760 ------- 7815 ------- 7861 ------- 7917 ------- 7969 ------- 8018 ------- 8063 ------- 8112 ------- 8180 ------- 8229 ------- 8268 ------- 8320 ------- 8376 ------- 8432 ------- 8474 ------- 8522 ------- 8569 ------- 8616 ------- 8664 ------- 8705 ------- 8765 ------- 8814 ------- 8868 ------- 8906 ------- 8948 ------- 8990 ------- 9035 ------- 9090 ------- 9137 ------- 9188 ------- 9241 ------- 9292 ------- 9354 ------- 9411 ------- 9472 ------- 9526 ------- 9569 ------- 9613 ------- 9658 ------- 9708 ------- 9737 ------- 9792 ------- 9838 ------- 9903 ------- 9952 ------- 10000
      │    │    │    │    │    │    ├── inner-join (hash)
      │    │    │    │    │    │    │    ├── save-table-name: q8_inner_join_10
      │    │    │    │    │    │    │    ├── columns: o_orderkey:33(int!null) o_custkey:34(int!null) o_orderdate:37(date!null) c_custkey:42(int!null) c_nationkey:45(int!null) n1.n_nationkey:50(int!null) n1.n_regionkey:52(int!null) n2.n_nationkey:54(int!null) n2.n_name:55(char!null) r_regionkey:58(int!null) r_name:59(char!null)
      │    │    │    │    │    │    │    ├── stats: [rows=2304369.03, distinct(33)=451700.52, null(33)=0, distinct(34)=99405.6121, null(34)=0, distinct(37)=731, null(37)=0, distinct(42)=99405.6121, null(42)=0, distinct(45)=24.9055527, null(45)=0, distinct(50)=24.9055527, null(50)=0, distinct(52)=1, null(52)=0, distinct(54)=24.9055527, null(54)=0, distinct(55)=24.9055527, null(55)=0, distinct(58)=1, null(58)=0, distinct(59)=1, null(59)=0]
      │    │    │    │    │    │    │    ├── key: (33,54)
      │    │    │    │    │    │    │    ├── fd: ()-->(59), (33)-->(34,37), (42)-->(45), (50)-->(52), (54)-->(55), (52)==(58), (58)==(52), (45)==(50), (50)==(45), (34)==(42), (42)==(34)
      │    │    │    │    │    │    │    ├── inner-join (cross)
      │    │    │    │    │    │    │    │    ├── save-table-name: q8_inner_join_11
      │    │    │    │    │    │    │    │    ├── columns: c_custkey:42(int!null) c_nationkey:45(int!null) n1.n_nationkey:50(int!null) n1.n_regionkey:52(int!null) n2.n_nationkey:54(int!null) n2.n_name:55(char!null) r_regionkey:58(int!null) r_name:59(char!null)
      │    │    │    │    │    │    │    │    ├── stats: [rows=750000, distinct(42)=147944.303, null(42)=0, distinct(45)=24.9055527, null(45)=0, distinct(50)=24.9055527, null(50)=0, distinct(52)=1, null(52)=0, distinct(54)=24.9055527, null(54)=0, distinct(55)=24.9055527, null(55)=0, distinct(58)=1, null(58)=0, distinct(59)=1, null(59)=0]
      │    │    │    │    │    │    │    │    ├── key: (42,54)
      │    │    │    │    │    │    │    │    ├── fd: ()-->(59), (42)-->(45), (50)-->(52), (54)-->(55), (52)==(58), (58)==(52), (45)==(50), (50)==(45)
      │    │    │    │    │    │    │    │    ├── inner-join (lookup customer@c_nk)
      │    │    │    │    │    │    │    │    │    ├── save-table-name: q8_lookup_join_12
      │    │    │    │    │    │    │    │    │    ├── columns: c_custkey:42(int!null) c_nationkey:45(int!null) n1.n_nationkey:50(int!null) n1.n_regionkey:52(int!null) r_regionkey:58(int!null) r_name:59(char!null)
      │    │    │    │    │    │    │    │    │    ├── key columns: [50] = [45]
      │    │    │    │    │    │    │    │    │    ├── stats: [rows=30000, distinct(42)=27672.3293, null(42)=0, distinct(45)=5, null(45)=0, distinct(50)=5, null(50)=0, distinct(52)=1, null(52)=0, distinct(58)=1, null(58)=0, distinct(59)=0.996222107, null(59)=0]
      │    │    │    │    │    │    │    │    │    ├── key: (42)
      │    │    │    │    │    │    │    │    │    ├── fd: ()-->(59), (50)-->(52), (52)==(58), (58)==(52), (42)-->(45), (45)==(50), (50)==(45)
      │    │    │    │    │    │    │    │    │    ├── inner-join (merge)
      │    │    │    │    │    │    │    │    │    │    ├── save-table-name: q8_merge_join_13
      │    │    │    │    │    │    │    │    │    │    ├── columns: n1.n_nationkey:50(int!null) n1.n_regionkey:52(int!null) r_regionkey:58(int!null) r_name:59(char!null)
      │    │    │    │    │    │    │    │    │    │    ├── left ordering: +58
      │    │    │    │    │    │    │    │    │    │    ├── right ordering: +52
      │    │    │    │    │    │    │    │    │    │    ├── stats: [rows=5, distinct(50)=5, null(50)=0, distinct(52)=1, null(52)=0, distinct(58)=1, null(58)=0, distinct(59)=0.996222107, null(59)=0]
      │    │    │    │    │    │    │    │    │    │    ├── key: (50)
      │    │    │    │    │    │    │    │    │    │    ├── fd: ()-->(59), (50)-->(52), (52)==(58), (58)==(52)
      │    │    │    │    │    │    │    │    │    │    ├── select
      │    │    │    │    │    │    │    │    │    │    │    ├── save-table-name: q8_select_14
      │    │    │    │    │    │    │    │    │    │    │    ├── columns: r_regionkey:58(int!null) r_name:59(char!null)
      │    │    │    │    │    │    │    │    │    │    │    ├── stats: [rows=1, distinct(58)=1, null(58)=0, distinct(59)=1, null(59)=0]
      │    │    │    │    │    │    │    │    │    │    │    ├── key: (58)
      │    │    │    │    │    │    │    │    │    │    │    ├── fd: ()-->(59)
      │    │    │    │    │    │    │    │    │    │    │    ├── ordering: +58 opt(59) [actual: +58]
      │    │    │    │    │    │    │    │    │    │    │    ├── scan region
      │    │    │    │    │    │    │    │    │    │    │    │    ├── save-table-name: q8_scan_15
      │    │    │    │    │    │    │    │    │    │    │    │    ├── columns: r_regionkey:58(int!null) r_name:59(char!null)
      │    │    │    │    │    │    │    │    │    │    │    │    ├── stats: [rows=5, distinct(58)=5, null(58)=0, distinct(59)=5, null(59)=0]
      │    │    │    │    │    │    │    │    │    │    │    │    │   histogram(58)=  0  1  0  1  0  1  0  1  0  1
      │    │    │    │    │    │    │    │    │    │    │    │    │                 <--- 0 --- 1 --- 2 --- 3 --- 4
      │    │    │    │    │    │    │    │    │    │    │    │    ├── key: (58)
      │    │    │    │    │    │    │    │    │    │    │    │    ├── fd: (58)-->(59)
      │    │    │    │    │    │    │    │    │    │    │    │    └── ordering: +58 opt(59) [actual: +58]
      │    │    │    │    │    │    │    │    │    │    │    └── filters
      │    │    │    │    │    │    │    │    │    │    │         └── r_name = 'AMERICA' [type=bool, outer=(59), constraints=(/59: [/'AMERICA' - /'AMERICA']; tight), fd=()-->(59)]
      │    │    │    │    │    │    │    │    │    │    ├── scan n1@n_rk
      │    │    │    │    │    │    │    │    │    │    │    ├── save-table-name: q8_scan_16
      │    │    │    │    │    │    │    │    │    │    │    ├── columns: n1.n_nationkey:50(int!null) n1.n_regionkey:52(int!null)
      │    │    │    │    │    │    │    │    │    │    │    ├── stats: [rows=25, distinct(50)=25, null(50)=0, distinct(52)=5, null(52)=0]
      │    │    │    │    │    │    │    │    │    │    │    │   histogram(50)=  0  1  0  1  0  1  0  1  0  1  0  1  0  1  0  1  0  1  0  1  0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1
      │    │    │    │    │    │    │    │    │    │    │    │                 <--- 0 --- 1 --- 2 --- 3 --- 4 --- 5 --- 6 --- 7 --- 8 --- 9 --- 10 --- 11 --- 12 --- 13 --- 14 --- 15 --- 16 --- 17 --- 18 --- 19 --- 20 --- 21 --- 22 --- 23 --- 24
      │    │    │    │    │    │    │    │    │    │    │    │   histogram(52)=  0  5  0  5  0  5  0  5  0  5
      │    │    │    │    │    │    │    │    │    │    │    │                 <--- 0 --- 1 --- 2 --- 3 --- 4
      │    │    │    │    │    │    │    │    │    │    │    ├── key: (50)
      │    │    │    │    │    │    │    │    │    │    │    ├── fd: (50)-->(52)
      │    │    │    │    │    │    │    │    │    │    │    └── ordering: +52
      │    │    │    │    │    │    │    │    │    │    └── filters (true)
      │    │    │    │    │    │    │    │    │    └── filters (true)
      │    │    │    │    │    │    │    │    ├── scan n2
      │    │    │    │    │    │    │    │    │    ├── save-table-name: q8_scan_17
      │    │    │    │    │    │    │    │    │    ├── columns: n2.n_nationkey:54(int!null) n2.n_name:55(char!null)
      │    │    │    │    │    │    │    │    │    ├── stats: [rows=25, distinct(54)=25, null(54)=0, distinct(55)=25, null(55)=0]
      │    │    │    │    │    │    │    │    │    │   histogram(54)=  0  1  0  1  0  1  0  1  0  1  0  1  0  1  0  1  0  1  0  1  0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1   0  1
      │    │    │    │    │    │    │    │    │    │                 <--- 0 --- 1 --- 2 --- 3 --- 4 --- 5 --- 6 --- 7 --- 8 --- 9 --- 10 --- 11 --- 12 --- 13 --- 14 --- 15 --- 16 --- 17 --- 18 --- 19 --- 20 --- 21 --- 22 --- 23 --- 24
      │    │    │    │    │    │    │    │    │    ├── key: (54)
      │    │    │    │    │    │    │    │    │    └── fd: (54)-->(55)
      │    │    │    │    │    │    │    │    └── filters (true)
      │    │    │    │    │    │    │    ├── select
      │    │    │    │    │    │    │    │    ├── save-table-name: q8_select_18
      │    │    │    │    │    │    │    │    ├── columns: o_orderkey:33(int!null) o_custkey:34(int!null) o_orderdate:37(date!null)
      │    │    │    │    │    │    │    │    ├── stats: [rows=454557.692, distinct(33)=454557.692, null(33)=0, distinct(34)=99405.6121, null(34)=0, distinct(37)=731, null(37)=0]
      │    │    │    │    │    │    │    │    │   histogram(37)=  0       0        6507.7      1050      6750      900       6750      1200      6750      600       7200      1050      6150      1500      7200      300       7050      300       6750      900       6900      450       7200      1050      7200      450       7050      600       6750      750       6150      1200      7200      1200      6750      750       7050      450       7200      600       6450      1050      6600      600       7050      750       7050      150       6600      1200      6150      1050      6450      1050      6150      1050      6750      450       7050      300       5700      1500      7050      600       6300      1050      6900      750       6600      750       7050      1050      6600      750       6750      1050      7050      450       6900      900       7050      600       6600      750       6750      900       6900      750       6750      600       6300      1050      6750      600       6900      750       7050      900       6750      600       7050      450       6900      750       6600      600       7050      1050      6900      900       6900      750       6450      900       6750      600       6750      450       7050      450       7050      150       600      600
      │    │    │    │    │    │    │    │    │                 <--- '1994-12-31' -------- '1995-01-13' ------ '1995-01-25' ------ '1995-02-04' ------ '1995-02-16' ------ '1995-02-26' ------ '1995-03-10' ------ '1995-03-20' ------ '1995-04-02' ------ '1995-04-15' ------ '1995-04-28' ------ '1995-05-10' ------ '1995-05-25' ------ '1995-06-09' ------ '1995-06-20' ------ '1995-07-01' ------ '1995-07-13' ------ '1995-07-21' ------ '1995-08-01' ------ '1995-08-13' ------ '1995-08-25' ------ '1995-09-06' ------ '1995-09-18' ------ '1995-10-01' ------ '1995-10-11' ------ '1995-10-23' ------ '1995-11-01' ------ '1995-11-13' ------ '1995-11-26' ------ '1995-12-08' ------ '1995-12-22' ------ '1996-01-06' ------ '1996-01-18' ------ '1996-01-30' ------ '1996-02-13' ------ '1996-02-25' ------ '1996-03-09' ------ '1996-03-21' ------ '1996-04-04' ------ '1996-04-14' ------ '1996-04-27' ------ '1996-05-10' ------ '1996-05-22' ------ '1996-06-02' ------ '1996-06-12' ------ '1996-06-23' ------ '1996-07-07' ------ '1996-07-19' ------ '1996-08-01' ------ '1996-08-14' ------ '1996-08-25' ------ '1996-09-06' ------ '1996-09-20' ------ '1996-10-04' ------ '1996-10-15' ------ '1996-10-28' ------ '1996-11-11' ------ '1996-11-22' ------ '1996-12-04' ------ '1996-12-18' ------ '1996-12-29' ----- '1996-12-31'
      │    │    │    │    │    │    │    │    ├── key: (33)
      │    │    │    │    │    │    │    │    ├── fd: (33)-->(34,37)
      │    │    │    │    │    │    │    │    ├── scan orders
      │    │    │    │    │    │    │    │    │    ├── save-table-name: q8_scan_19
      │    │    │    │    │    │    │    │    │    ├── columns: o_orderkey:33(int!null) o_custkey:34(int!null) o_orderdate:37(date!null)
      │    │    │    │    │    │    │    │    │    ├── stats: [rows=1500000, distinct(33)=1500000, null(33)=0, distinct(34)=99846, null(34)=0, distinct(37)=2406, null(37)=0]
      │    │    │    │    │    │    │    │    │    │   histogram(33)=  0  150  7350   150   7350   150   7350   150   7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7350    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150    7500    150
      │    │    │    │    │    │    │    │    │    │                 <--- 998 ------ 26593 ------ 56613 ------ 85827 ------ 115587 ------ 140512 ------ 167076 ------ 198882 ------ 228580 ------ 262243 ------ 292064 ------ 316161 ------ 344194 ------ 368550 ------ 402722 ------ 434529 ------ 468807 ------ 495107 ------ 526338 ------ 563239 ------ 597733 ------ 641894 ------ 665730 ------ 688742 ------ 721767 ------ 750050 ------ 787879 ------ 814565 ------ 837381 ------ 866657 ------ 902855 ------ 927172 ------ 952772 ------ 975840 ------ 1008646 ------ 1032066 ------ 1074656 ------ 1104896 ------ 1138369 ------ 1166689 ------ 1194912 ------ 1225222 ------ 1253284 ------ 1284803 ------ 1318499 ------ 1348609 ------ 1376609 ------ 1404933 ------ 1435745 ------ 1460325 ------ 1491648 ------ 1518852 ------ 1542567 ------ 1574277 ------ 1597958 ------ 1624964 ------ 1647555 ------ 1683651 ------ 1717189 ------ 1750563 ------ 1784775 ------ 1812449 ------ 1838850 ------ 1867751 ------ 1891783 ------ 1918790 ------ 1949827 ------ 1986021 ------ 2020134 ------ 2045829 ------ 2077894 ------ 2118912 ------ 2143264 ------ 2176486 ------ 2204838 ------ 2234146 ------ 2260484 ------ 2288512 ------ 2317121 ------ 2344321 ------ 2362567 ------ 2396133 ------ 2423623 ------ 2454884 ------ 2483879 ------ 2520162 ------ 2545574 ------ 2571874 ------ 2608417 ------ 2637477 ------ 2665607 ------ 2692231 ------ 2724261 ------ 2764451 ------ 2798656 ------ 2824775 ------ 2858690 ------ 2881990 ------ 2911814 ------ 2945056 ------ 2981315 ------ 3010306 ------ 3032320 ------ 3064389 ------ 3084166 ------ 3108832 ------ 3136032 ------ 3168484 ------ 3204039 ------ 3229922 ------ 3256549 ------ 3283169 ------ 3315236 ------ 3346756 ------ 3375879 ------ 3408007 ------ 3441827 ------ 3471204 ------ 3505414 ------ 3527938 ------ 3562561 ------ 3598630 ------ 3627270 ------ 3659266 ------ 3686468 ------ 3713505 ------ 3750817 ------ 3777696 ------ 3808129 ------ 3834533 ------ 3871968 ------ 3904931 ------ 3934215 ------ 3960643 ------ 3990336 ------ 4023203 ------ 4057826 ------ 4090691 ------ 4121216 ------ 4159681 ------ 4190726 ------ 4222624 ------ 4246567 ------ 4283653 ------ 4314339 ------ 4342592 ------ 4373829 ------ 4402372 ------ 4431332 ------ 4464452 ------ 4496327 ------ 4526789 ------ 4551109 ------ 4582401 ------ 4615974 ------ 4648482 ------ 4669601 ------ 4705891 ------ 4732869 ------ 4766145 ------ 4805862 ------ 4840677 ------ 4866787 ------ 4895332 ------ 4928100 ------ 4956323 ------ 4992161 ------ 5027008 ------ 5065797 ------ 5099011 ------ 5130592 ------ 5163463 ------ 5197314 ------ 5224994 ------ 5253892 ------ 5277638 ------ 5307105 ------ 5335750 ------ 5369828 ------ 5402528 ------ 5434183 ------ 5464227 ------ 5491072 ------ 5520679 ------ 5543047 ------ 5576708 ------ 5614951 ------ 5646055 ------ 5674721 ------ 5700295 ------ 5732066 ------ 5761255 ------ 5791233 ------ 5819651 ------ 5852291 ------ 5880258 ------ 5909062 ------ 5943111 ------ 5973926 ------ 5998752
      │    │    │    │    │    │    │    │    │    │   histogram(34)=  0 150 7350  150  7350  150   7350  150   7350  150   7350  150   7350  150   7350  150   7350  150   7350  150   7350  150   7350  150   7350  150   7350  150   7350   150   7350   150   7350   150   7350   150   7350   300   7350   150   7350   150   7350   300   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7200   300   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7200   300   7350   150   7350   150   7350   150   7350   150   7200   300   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   300   7350   150   7350   300   7350   150   7350   150   7350   150   7350   150   7350   300   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   300   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   300   7350   150   7350   300   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   300   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7200   300   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   150   7350   300   7350   150   7350   150   7350   150   7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   300    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7350   150    7500   150    7500   150    7500   150    7500   150    7500   150    7500   150    7500   300    7350   150    7500   150    7500   150    7500   150    7500   150    7350   300    7500   150    7500   150    7500   150    7500   150    7500   150    7500   150    7500   150    7500   150    7500   150    7500   150    7500   150    7500   150    7500   150    7500   150    7500   150    7500   150    7500   150    7350   300    7500   150    7500   150    7500   150    7500   150    7500   150    7350   300    7500   150
      │    │    │    │    │    │    │    │    │    │                 <--- 8 ------ 763 ------ 1477 ------ 2353 ------ 3229 ------ 4261 ------ 5191 ------ 5924 ------ 6406 ------ 7126 ------ 7870 ------ 8545 ------ 9301 ------ 9911 ------ 10591 ------ 11236 ------ 11854 ------ 12622 ------ 13426 ------ 14036 ------ 14708 ------ 15391 ------ 16138 ------ 16925 ------ 17681 ------ 18388 ------ 19156 ------ 20015 ------ 20660 ------ 21632 ------ 22472 ------ 23260 ------ 24055 ------ 24649 ------ 25352 ------ 25952 ------ 26774 ------ 27358 ------ 28070 ------ 28586 ------ 29296 ------ 30028 ------ 30629 ------ 31400 ------ 32102 ------ 32884 ------ 33796 ------ 34646 ------ 35479 ------ 36161 ------ 36811 ------ 37612 ------ 38314 ------ 39145 ------ 39844 ------ 40591 ------ 41254 ------ 41902 ------ 42496 ------ 43237 ------ 43948 ------ 44690 ------ 45481 ------ 46448 ------ 47242 ------ 47884 ------ 48676 ------ 49441 ------ 50155 ------ 50857 ------ 51463 ------ 52321 ------ 53014 ------ 53587 ------ 54413 ------ 55019 ------ 55771 ------ 56482 ------ 57314 ------ 58163 ------ 58894 ------ 59638 ------ 60478 ------ 61450 ------ 62417 ------ 63176 ------ 63944 ------ 64577 ------ 65344 ------ 66218 ------ 67021 ------ 67703 ------ 68477 ------ 69271 ------ 70073 ------ 70696 ------ 71512 ------ 72430 ------ 73345 ------ 74149 ------ 74780 ------ 75508 ------ 76273 ------ 76865 ------ 77666 ------ 78427 ------ 79042 ------ 79801 ------ 80557 ------ 81163 ------ 81833 ------ 82534 ------ 83368 ------ 84157 ------ 84938 ------ 85495 ------ 86257 ------ 87143 ------ 87998 ------ 88777 ------ 89566 ------ 90292 ------ 91099 ------ 91757 ------ 92401 ------ 93362 ------ 94252 ------ 94771 ------ 95527 ------ 96233 ------ 96952 ------ 97844 ------ 98411 ------ 99067 ------ 99691 ------ 100357 ------ 101009 ------ 101734 ------ 102569 ------ 103381 ------ 104114 ------ 105070 ------ 105884 ------ 106651 ------ 107393 ------ 107995 ------ 108772 ------ 109628 ------ 110383 ------ 111040 ------ 111658 ------ 112556 ------ 113338 ------ 114062 ------ 114895 ------ 115744 ------ 116554 ------ 117250 ------ 117967 ------ 118741 ------ 119540 ------ 120514 ------ 121333 ------ 122111 ------ 122989 ------ 123763 ------ 124735 ------ 125401 ------ 126022 ------ 126779 ------ 127618 ------ 128332 ------ 129167 ------ 129917 ------ 130669 ------ 131330 ------ 131911 ------ 132704 ------ 133553 ------ 134317 ------ 134960 ------ 135688 ------ 136519 ------ 137353 ------ 138061 ------ 138697 ------ 139468 ------ 140218 ------ 140942 ------ 141644 ------ 142415 ------ 143263 ------ 144352 ------ 145099 ------ 145811 ------ 146761 ------ 147643 ------ 148591 ------ 149164 ------ 149995
      │    │    │    │    │    │    │    │    │    │   histogram(37)=  0      450       6600      900       6300      1350      7200      300       6750      1050      7350      300       7350      150       7200      300       7350      1200      6900      750       6600      900       6750      900       6300      1350      7350      750       7050      450       6900      900       7350      150       7200      450       7050      750       6750      750       6900      750       7350      600       6750      900       6750      750       7050      450       7050      900       6900      1050      6600      900       7350      750       6900      1050      6750      750       6750      900       7050      450       7050      750       7200      450       7050      750       6300      1800      6600      750       7200      1200      7050      600       7050      450       6600      1050      7050      450       6900      450       7200      450       6750      600       6600      900       7050      1200      6600      1200      7050      750       6600      900       6750      600       7200      450       6900      600       6600      1350      6900      1050      6300      1050      6750      1050      6900      450       7050      600       6900      450       7200      1500      7200      300       6450      900       7200      1050      6600      900       7050      600       6900      900       6600      900       6600      750       6900      1050      6450      900       7050      1350      6750      1050      6150      1500      7200      600       6900      600       6900      450       7050      300       6600      750       7200      600       6750      600       7200      300       7200      1350      7050      1200      6600      1050      7050      900       7050      450       6450      1050      6900      450       7050      1050      6750      900       6750      1200      6750      600       7200      1050      6150      1500      7200      300       7050      300       6750      900       6900      450       7200      1050      7200      450       7050      600       6750      750       6150      1200      7200      1200      6750      750       7050      450       7200      600       6450      1050      6600      600       7050      750       7050      150       6600      1200      6150      1050      6450      1050      6150      1050      6750      450       7050      300       5700      1500      7050      600       6300      1050      6900      750       6600      750       7050      1050      6600      750       6750      1050      7050      450       6900      900       7050      600       6600      750       6750      900       6900      750       6750      600       6300      1050      6750      600       6900      750       7050      900       6750      600       7050      450       6900      750       6600      600       7050      1050      6900      900       6900      750       6450      900       6750      600       6750      450       7050      450       7050      150       6600      1050      6900      600       6750      600       6300      900       6450      750       6600      600       6900      450       7050      750       6450      750       6300      900       6600      750       6450      1650      6450      750       6450      750       6900      450       5850      1350      6450      600       6300      1350      6750      750       6900      600       6900      1350      6000      1650      6600      750       6600      900       6300      1050      6300      750       6600      900       6000      900       6000      900       6600      450       6750      450       6450      750       6750      300       6450      450       6300      900       6450      450       6300      600       6300      750       6300      900       6750      1050      5850      1200      6150      1050      6300      750       6300      600       6600      750       6000      900       5550      1200      6300      450       5700      600       6000      450
      │    │    │    │    │    │    │    │    │    │                 <--- '1992-01-01' ------ '1992-01-11' ------ '1992-01-23' ------ '1992-02-04' ------ '1992-02-19' ------ '1992-03-03' ------ '1992-03-18' ------ '1992-03-29' ------ '1992-04-11' ------ '1992-04-23' ------ '1992-05-08' ------ '1992-05-20' ------ '1992-05-30' ------ '1992-06-11' ------ '1992-06-24' ------ '1992-07-05' ------ '1992-07-18' ------ '1992-07-30' ------ '1992-08-11' ------ '1992-08-23' ------ '1992-09-07' ------ '1992-09-21' ------ '1992-10-04' ------ '1992-10-18' ------ '1992-10-28' ------ '1992-11-07' ------ '1992-11-18' ------ '1992-11-30' ------ '1992-12-10' ------ '1992-12-25' ------ '1993-01-06' ------ '1993-01-19' ------ '1993-02-01' ------ '1993-02-14' ------ '1993-02-24' ------ '1993-03-08' ------ '1993-03-19' ------ '1993-04-03' ------ '1993-04-14' ------ '1993-04-25' ------ '1993-05-12' ------ '1993-05-25' ------ '1993-06-10' ------ '1993-06-18' ------ '1993-07-01' ------ '1993-07-12' ------ '1993-07-24' ------ '1993-08-05' ------ '1993-08-16' ------ '1993-08-29' ------ '1993-09-08' ------ '1993-09-19' ------ '1993-10-01' ------ '1993-10-13' ------ '1993-10-22' ------ '1993-11-04' ------ '1993-11-16' ------ '1993-11-30' ------ '1993-12-16' ------ '1993-12-29' ------ '1994-01-12' ------ '1994-01-23' ------ '1994-02-04' ------ '1994-02-16' ------ '1994-03-01' ------ '1994-03-14' ------ '1994-03-24' ------ '1994-04-06' ------ '1994-04-20' ------ '1994-05-01' ------ '1994-05-12' ------ '1994-05-23' ------ '1994-06-03' ------ '1994-06-16' ------ '1994-06-25' ------ '1994-07-08' ------ '1994-07-19' ------ '1994-08-01' ------ '1994-08-14' ------ '1994-08-25' ------ '1994-09-06' ------ '1994-09-18' ------ '1994-10-01' ------ '1994-10-17' ------ '1994-10-30' ------ '1994-11-10' ------ '1994-11-22' ------ '1994-12-02' ------ '1994-12-16' ------ '1994-12-30' ------ '1995-01-13' ------ '1995-01-25' ------ '1995-02-04' ------ '1995-02-16' ------ '1995-02-26' ------ '1995-03-10' ------ '1995-03-20' ------ '1995-04-02' ------ '1995-04-15' ------ '1995-04-28' ------ '1995-05-10' ------ '1995-05-25' ------ '1995-06-09' ------ '1995-06-20' ------ '1995-07-01' ------ '1995-07-13' ------ '1995-07-21' ------ '1995-08-01' ------ '1995-08-13' ------ '1995-08-25' ------ '1995-09-06' ------ '1995-09-18' ------ '1995-10-01' ------ '1995-10-11' ------ '1995-10-23' ------ '1995-11-01' ------ '1995-11-13' ------ '1995-11-26' ------ '1995-12-08' ------ '1995-12-22' ------ '1996-01-06' ------ '1996-01-18' ------ '1996-01-30' ------ '1996-02-13' ------ '1996-02-25' ------ '1996-03-09' ------ '1996-03-21' ------ '1996-04-04' ------ '1996-04-14' ------ '1996-04-27' ------ '1996-05-10' ------ '1996-05-22' ------ '1996-06-02' ------ '1996-06-12' ------ '1996-06-23' ------ '1996-07-07' ------ '1996-07-19' ------ '1996-08-01' ------ '1996-08-14' ------ '1996-08-25' ------ '1996-09-06' ------ '1996-09-20' ------ '1996-10-04' ------ '1996-10-15' ------ '1996-10-28' ------ '1996-11-11' ------ '1996-11-22' ------ '1996-12-04' ------ '1996-12-18' ------ '1996-12-29' ------ '1997-01-10' ------ '1997-01-22' ------ '1997-02-01' ------ '1997-02-13' ------ '1997-02-24' ------ '1997-03-09' ------ '1997-03-24' ------ '1997-04-04' ------ '1997-04-16' ------ '1997-04-26' ------ '1997-05-07' ------ '1997-05-19' ------ '1997-05-29' ------ '1997-06-08' ------ '1997-06-22' ------ '1997-07-05' ------ '1997-07-16' ------ '1997-07-28' ------ '1997-08-12' ------ '1997-08-23' ------ '1997-09-04' ------ '1997-09-17' ------ '1997-09-30' ------ '1997-10-09' ------ '1997-10-19' ------ '1997-10-31' ------ '1997-11-14' ------ '1997-11-24' ------ '1997-12-09' ------ '1997-12-24' ------ '1998-01-04' ------ '1998-01-16' ------ '1998-01-28' ------ '1998-02-07' ------ '1998-02-17' ------ '1998-03-01' ------ '1998-03-12' ------ '1998-03-24' ------ '1998-04-03' ------ '1998-04-14' ------ '1998-04-24' ------ '1998-05-03' ------ '1998-05-14' ------ '1998-05-26' ------ '1998-06-08' ------ '1998-06-20' ------ '1998-06-30' ------ '1998-07-11' ------ '1998-07-22' ------ '1998-08-02'
      │    │    │    │    │    │    │    │    │    ├── key: (33)
      │    │    │    │    │    │    │    │    │    └── fd: (33)-->(34,37)
      │    │    │    │    │    │    │    │    └── filters
      │    │    │    │    │    │    │    │         └── (o_orderdate >= '1995-01-01') AND (o_orderdate <= '1996-12-31') [type=bool, outer=(37), constraints=(/37: [/'1995-01-01' - /'1996-12-31']; tight)]
      │    │    │    │    │    │    │    └── filters
      │    │    │    │    │    │    │         └── o_custkey = c_custkey [type=bool, outer=(34,42), constraints=(/34: (/NULL - ]; /42: (/NULL - ]), fd=(34)==(42), (42)==(34)]
      │    │    │    │    │    │    └── filters
      │    │    │    │    │    │         └── l_orderkey = o_orderkey [type=bool, outer=(17,33), constraints=(/17: (/NULL - ]; /33: (/NULL - ]), fd=(17)==(33), (33)==(17)]
      │    │    │    │    │    ├── scan supplier@s_nk
      │    │    │    │    │    │    ├── save-table-name: q8_scan_20
      │    │    │    │    │    │    ├── columns: s_suppkey:10(int!null) s_nationkey:13(int!null)
      │    │    │    │    │    │    ├── stats: [rows=10000, distinct(10)=9920, null(10)=0, distinct(13)=25, null(13)=0]
      │    │    │    │    │    │    │   histogram(10)=  0  1  49  1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1   49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    49   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50   1    50    1
      │    │    │    │    │    │    │                 <--- 1 ---- 51 ---- 101 ---- 151 ---- 201 ---- 251 ---- 301 ---- 351 ---- 401 ---- 451 ---- 501 ---- 551 ---- 601 ---- 651 ---- 701 ---- 751 ---- 801 ---- 851 ---- 901 ---- 951 ---- 1001 ---- 1051 ---- 1101 ---- 1151 ---- 1201 ---- 1251 ---- 1301 ---- 1351 ---- 1401 ---- 1451 ---- 1501 ---- 1551 ---- 1601 ---- 1651 ---- 1701 ---- 1751 ---- 1801 ---- 1851 ---- 1901 ---- 1951 ---- 2001 ---- 2051 ---- 2101 ---- 2151 ---- 2201 ---- 2251 ---- 2301 ---- 2351 ---- 2401 ---- 2451 ---- 2501 ---- 2551 ---- 2601 ---- 2651 ---- 2701 ---- 2751 ---- 2801 ---- 2851 ---- 2901 ---- 2951 ---- 3001 ---- 3051 ---- 3101 ---- 3151 ---- 3201 ---- 3251 ---- 3301 ---- 3351 ---- 3401 ---- 3451 ---- 3501 ---- 3551 ---- 3601 ---- 3651 ---- 3701 ---- 3751 ---- 3801 ---- 3851 ---- 3901 ---- 3951 ---- 4001 ---- 4051 ---- 4101 ---- 4151 ---- 4201 ---- 4251 ---- 4301 ---- 4351 ---- 4401 ---- 4451 ---- 4501 ---- 4551 ---- 4601 ---- 4651 ---- 4701 ---- 4751 ---- 4801 ---- 4851 ---- 4901 ---- 4951 ---- 5001 ---- 5051 ---- 5101 ---- 5151 ---- 5201 ---- 5251 ---- 5301 ---- 5351 ---- 5401 ---- 5451 ---- 5501 ---- 5551 ---- 5601 ---- 5651 ---- 5701 ---- 5751 ---- 5801 ---- 5851 ---- 5901 ---- 5951 ---- 6001 ---- 6051 ---- 6101 ---- 6151 ---- 6201 ---- 6251 ---- 6301 ---- 6351 ---- 6401 ---- 6451 ---- 6501 ---- 6551 ---- 6601 ---- 6651 ---- 6701 ---- 6751 ---- 6801 ---- 6851 ---- 6901 ---- 6951 ---- 7001 ---- 7051 ---- 7101 ---- 7151 ---- 7201 ---- 7251 ---- 7301 ---- 7351 ---- 7401 ---- 7451 ---- 7501 ---- 7552 ---- 7603 ---- 7654 ---- 7705 ---- 7756 ---- 7807 ---- 7858 ---- 7909 ---- 7960 ---- 8011 ---- 8062 ---- 8113 ---- 8164 ---- 8215 ---- 8266 ---- 8317 ---- 8368 ---- 8419 ---- 8470 ---- 8521 ---- 8572 ---- 8623 ---- 8674 ---- 8725 ---- 8776 ---- 8827 ---- 8878 ---- 8929 ---- 8980 ---- 9031 ---- 9082 ---- 9133 ---- 9184 ---- 9235 ---- 9286 ---- 9337 ---- 9388 ---- 9439 ---- 9490 ---- 9541 ---- 9592 ---- 9643 ---- 9694 ---- 9745 ---- 9796 ---- 9847 ---- 9898 ---- 9949 ---- 10000
      │    │    │    │    │    │    │   histogram(13)=  0 420 0 413 0 397 0 412 0 415 0 380 0 402 0 396 0 415 0 405 0 393  0 438  0 377  0 362  0 376  0 373  0 406  0 421  0 407  0 398  0 411  0 399  0 401  0 390  0 393
      │    │    │    │    │    │    │                 <--- 0 --- 1 --- 2 --- 3 --- 4 --- 5 --- 6 --- 7 --- 8 --- 9 --- 10 --- 11 --- 12 --- 13 --- 14 --- 15 --- 16 --- 17 --- 18 --- 19 --- 20 --- 21 --- 22 --- 23 --- 24
      │    │    │    │    │    │    ├── key: (10)
      │    │    │    │    │    │    └── fd: (10)-->(13)
      │    │    │    │    │    └── filters
      │    │    │    │    │         ├── s_suppkey = l_suppkey [type=bool, outer=(10,19), constraints=(/10: (/NULL - ]; /19: (/NULL - ]), fd=(10)==(19), (19)==(10)]
      │    │    │    │    │         └── s_nationkey = n2.n_nationkey [type=bool, outer=(13,54), constraints=(/13: (/NULL - ]; /54: (/NULL - ]), fd=(13)==(54), (54)==(13)]
      │    │    │    │    ├── select
      │    │    │    │    │    ├── save-table-name: q8_select_21
      │    │    │    │    │    ├── columns: p_partkey:1(int!null) p_type:5(varchar!null)
      │    │    │    │    │    ├── stats: [rows=1333.33333, distinct(1)=1333.31636, null(1)=0, distinct(5)=1, null(5)=0]
      │    │    │    │    │    ├── key: (1)
      │    │    │    │    │    ├── fd: ()-->(5)
      │    │    │    │    │    ├── scan part
      │    │    │    │    │    │    ├── save-table-name: q8_scan_22
      │    │    │    │    │    │    ├── columns: p_partkey:1(int!null) p_type:5(varchar!null)
      │    │    │    │    │    │    ├── stats: [rows=200000, distinct(1)=199241, null(1)=0, distinct(5)=150, null(5)=0]
      │    │    │    │    │    │    │   histogram(1)=  0  20  980   20   980   20   980   20   980   20   980   20   980   20   980   20   980   20   980   20   980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980   20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    980    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20    1000    20
      │    │    │    │    │    │    │                <--- 27 ----- 1110 ----- 2241 ----- 3086 ----- 4134 ----- 5302 ----- 6222 ----- 7308 ----- 8249 ----- 9171 ----- 10049 ----- 10958 ----- 11832 ----- 13025 ----- 14063 ----- 14953 ----- 16249 ----- 17419 ----- 18363 ----- 19412 ----- 20257 ----- 21190 ----- 22110 ----- 23045 ----- 23956 ----- 24962 ----- 25942 ----- 26990 ----- 27934 ----- 28876 ----- 29513 ----- 30326 ----- 31259 ----- 32300 ----- 33577 ----- 34550 ----- 35562 ----- 36498 ----- 37475 ----- 38584 ----- 39641 ----- 40548 ----- 41605 ----- 42527 ----- 43612 ----- 44702 ----- 45701 ----- 46726 ----- 47795 ----- 48935 ----- 50152 ----- 51183 ----- 52001 ----- 52904 ----- 53868 ----- 54808 ----- 55986 ----- 57155 ----- 58516 ----- 59526 ----- 60557 ----- 61547 ----- 62369 ----- 63672 ----- 64583 ----- 65360 ----- 66147 ----- 67201 ----- 68142 ----- 69145 ----- 70209 ----- 71141 ----- 71923 ----- 73031 ----- 73987 ----- 74974 ----- 76170 ----- 77138 ----- 77849 ----- 78931 ----- 79832 ----- 80761 ----- 81843 ----- 82834 ----- 84032 ----- 85072 ----- 86287 ----- 87302 ----- 88422 ----- 89432 ----- 90550 ----- 91463 ----- 92249 ----- 93385 ----- 94789 ----- 96013 ----- 96893 ----- 98000 ----- 99008 ----- 100166 ----- 101263 ----- 102351 ----- 103236 ----- 104121 ----- 105363 ----- 106329 ----- 107325 ----- 108231 ----- 109054 ----- 110019 ----- 111185 ----- 112112 ----- 112908 ----- 113904 ----- 114785 ----- 115410 ----- 116526 ----- 117559 ----- 118310 ----- 119073 ----- 120034 ----- 120817 ----- 121744 ----- 122566 ----- 123720 ----- 124813 ----- 125835 ----- 126622 ----- 127651 ----- 128328 ----- 129315 ----- 130244 ----- 131450 ----- 132439 ----- 133288 ----- 134164 ----- 135298 ----- 136347 ----- 137243 ----- 138256 ----- 139427 ----- 140374 ----- 141371 ----- 142302 ----- 143322 ----- 144335 ----- 145333 ----- 146212 ----- 147321 ----- 148591 ----- 149594 ------ 150514 ------ 151361 ------ 152059 ------ 153070 ------ 154059 ------ 155259 ------ 156473 ------ 157690 ------ 158703 ------ 159675 ------ 160597 ------ 161668 ------ 162737 ------ 163955 ------ 164942 ------ 165924 ------ 167059 ------ 167866 ------ 169034 ------ 169935 ------ 170712 ------ 171806 ------ 172841 ------ 174078 ------ 175347 ------ 176430 ------ 177346 ------ 178566 ------ 179515 ------ 180677 ------ 181729 ------ 182983 ------ 183814 ------ 184892 ------ 185696 ------ 186611 ------ 187744 ------ 188974 ------ 189911 ------ 190671 ------ 191607 ------ 192820 ------ 193789 ------ 195057 ------ 196224 ------ 197231 ------ 198281 ------ 199119 ------ 199999
      │    │    │    │    │    │    ├── key: (1)
      │    │    │    │    │    │    └── fd: (1)-->(5)
      │    │    │    │    │    └── filters
      │    │    │    │    │         └── p_type = 'ECONOMY ANODIZED STEEL' [type=bool, outer=(5), constraints=(/5: [/'ECONOMY ANODIZED STEEL' - /'ECONOMY ANODIZED STEEL']; tight), fd=()-->(5)]
      │    │    │    │    └── filters
      │    │    │    │         └── p_partkey = l_partkey [type=bool, outer=(1,18), constraints=(/1: (/NULL - ]; /18: (/NULL - ]), fd=(1)==(18), (18)==(1)]
      │    │    │    └── projections
      │    │    │         ├── extract('year', o_orderdate) [type=int, outer=(37)]
      │    │    │         └── l_extendedprice * (1.0 - l_discount) [type=float, outer=(22,23)]
      │    │    └── projections
      │    │         └── CASE WHEN n2.n_name = 'BRAZIL' THEN volume ELSE 0.0 END [type=float, outer=(55,62)]
      │    └── aggregations
      │         ├── sum [type=float, outer=(63)]
      │         │    └── variable: column63 [type=float]
      │         └── sum [type=float, outer=(62)]
      │              └── variable: volume [type=float]
      └── projections
           └── sum / sum [type=float, outer=(64,65), side-effects]


stats table=q8_sort_1
----
column_names  row_count  distinct_count  null_count
{mkt_share}   2          2               0
{o_year}      2          2               0
~~~~
column_names  row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{mkt_share}   717.00         358.50 <==     717.00              358.50 <==          0.00            1.00
{o_year}      717.00         358.50 <==     717.00              358.50 <==          0.00            1.00

stats table=q8_project_2
----
column_names  row_count  distinct_count  null_count
{mkt_share}   2          2               0
{o_year}      2          2               0
~~~~
column_names  row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{mkt_share}   717.00         358.50 <==     717.00              358.50 <==          0.00            1.00
{o_year}      717.00         358.50 <==     717.00              358.50 <==          0.00            1.00

stats table=q8_group_by_3
----
column_names  row_count  distinct_count  null_count
{o_year}      2          2               0
{sum_1}       2          2               0
{sum}         2          2               0
~~~~
column_names  row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{o_year}      717.00         358.50 <==     717.00              358.50 <==          0.00            1.00
{sum}         717.00         358.50 <==     717.00              358.50 <==          0.00            1.00
{sum_1}       717.00         358.50 <==     717.00              358.50 <==          0.00            1.00

stats table=q8_project_4
----
column_names  row_count  distinct_count  null_count
{column63}    2603       108             0
{o_year}      2603       2               0
{volume}      2603       2599            0
~~~~
column_names  row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{column63}    2909.00        1.12           2897.00             26.82 <==           0.00            1.00
{o_year}      2909.00        1.12           717.00              358.50 <==          0.00            1.00
{volume}      2909.00        1.12           2897.00             1.11                0.00            1.00

stats table=q8_project_5
----
column_names  row_count  distinct_count  null_count
{n_name}      2603       25              0
{o_year}      2603       2               0
{volume}      2603       2599            0
~~~~
column_names  row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{n_name}      2909.00        1.12           25.00               1.00                0.00            1.00
{o_year}      2909.00        1.12           717.00              358.50 <==          0.00            1.00
{volume}      2909.00        1.12           2897.00             1.11                0.00            1.00

stats table=q8_inner_join_6
----
column_names       row_count  distinct_count  null_count
{c_custkey}        2603       2385            0
{c_nationkey}      2603       5               0
{l_discount}       2603       11              0
{l_extendedprice}  2603       2540            0
{l_orderkey}       2603       2567            0
{l_partkey}        2603       1221            0
{l_suppkey}        2603       1895            0
{n_name}           2603       25              0
{n_nationkey_1}    2603       25              0
{n_nationkey}      2603       5               0
{n_regionkey}      2603       1               0
{o_custkey}        2603       2385            0
{o_orderdate}      2603       708             0
{o_orderkey}       2603       2567            0
{p_partkey}        2603       1221            0
{p_type}           2603       1               0
{r_name}           2603       1               0
{r_regionkey}      2603       1               0
{s_nationkey}      2603       25              0
{s_suppkey}        2603       1895            0
~~~~
column_names       row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{c_custkey}        2909.00        1.12           2866.00             1.20                0.00            1.00
{c_nationkey}      2909.00        1.12           25.00               5.00 <==            0.00            1.00
{l_discount}       2909.00        1.12           11.00               1.00                0.00            1.00
{l_extendedprice}  2909.00        1.12           2895.00             1.14                0.00            1.00
{l_orderkey}       2909.00        1.12           2892.00             1.13                0.00            1.00
{l_partkey}        2909.00        1.12           1333.00             1.09                0.00            1.00
{l_suppkey}        2909.00        1.12           2521.00             1.33                0.00            1.00
{n_name}           2909.00        1.12           25.00               1.00                0.00            1.00
{n_nationkey}      2909.00        1.12           25.00               5.00 <==            0.00            1.00
{n_nationkey_1}    2909.00        1.12           25.00               1.00                0.00            1.00
{n_regionkey}      2909.00        1.12           1.00                1.00                0.00            1.00
{o_custkey}        2909.00        1.12           2866.00             1.20                0.00            1.00
{o_orderdate}      2909.00        1.12           717.00              1.01                0.00            1.00
{o_orderkey}       2909.00        1.12           2892.00             1.13                0.00            1.00
{p_partkey}        2909.00        1.12           1333.00             1.09                0.00            1.00
{p_type}           2909.00        1.12           1.00                1.00                0.00            1.00
{r_name}           2909.00        1.12           1.00                1.00                0.00            1.00
{r_regionkey}      2909.00        1.12           1.00                1.00                0.00            1.00
{s_nationkey}      2909.00        1.12           25.00               1.00                0.00            1.00
{s_suppkey}        2909.00        1.12           2521.00             1.33                0.00            1.00

stats table=q8_inner_join_7
----
column_names       row_count  distinct_count  null_count
{c_custkey}        365091     19542           0
{c_nationkey}      365091     5               0
{l_discount}       365091     11              0
{l_extendedprice}  365091     299348          0
{l_orderkey}       365091     92088           0
{l_partkey}        365091     167385          0
{l_suppkey}        365091     9920            0
{n_name}           365091     25              0
{n_nationkey_1}    365091     25              0
{n_nationkey}      365091     5               0
{n_regionkey}      365091     1               0
{o_custkey}        365091     19542           0
{o_orderdate}      365091     731             0
{o_orderkey}       365091     92088           0
{r_name}           365091     1               0
{r_regionkey}      365091     1               0
{s_nationkey}      365091     25              0
{s_suppkey}        365091     9920            0
~~~~
column_names       row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{c_custkey}        365110.00      1.00           96881.00            4.96 <==            0.00            1.00
{c_nationkey}      365110.00      1.00           25.00               5.00 <==            0.00            1.00
{l_discount}       365110.00      1.00           11.00               1.00                0.00            1.00
{l_extendedprice}  365110.00      1.00           301722.00           1.01                0.00            1.00
{l_orderkey}       365110.00      1.00           250417.00           2.72 <==            0.00            1.00
{l_partkey}        365110.00      1.00           167360.00           1.00                0.00            1.00
{l_suppkey}        365110.00      1.00           9920.00             1.00                0.00            1.00
{n_name}           365110.00      1.00           25.00               1.00                0.00            1.00
{n_nationkey}      365110.00      1.00           25.00               5.00 <==            0.00            1.00
{n_nationkey_1}    365110.00      1.00           25.00               1.00                0.00            1.00
{n_regionkey}      365110.00      1.00           1.00                1.00                0.00            1.00
{o_custkey}        365110.00      1.00           96881.00            4.96 <==            0.00            1.00
{o_orderdate}      365110.00      1.00           731.00              1.00                0.00            1.00
{o_orderkey}       365110.00      1.00           250417.00           2.72 <==            0.00            1.00
{r_name}           365110.00      1.00           1.00                1.00                0.00            1.00
{r_regionkey}      365110.00      1.00           1.00                1.00                0.00            1.00
{s_nationkey}      365110.00      1.00           25.00               1.00                0.00            1.00
{s_suppkey}        365110.00      1.00           9920.00             1.00                0.00            1.00

stats table=q8_inner_join_8
----
column_names       row_count  distinct_count  null_count
{c_custkey}        9127275    19542           0
{c_nationkey}      9127275    5               0
{l_discount}       9127275    11              0
{l_extendedprice}  9127275    299348          0
{l_orderkey}       9127275    92088           0
{l_partkey}        9127275    167385          0
{l_suppkey}        9127275    9920            0
{n_name}           9127275    25              0
{n_nationkey_1}    9127275    25              0
{n_nationkey}      9127275    5               0
{n_regionkey}      9127275    1               0
{o_custkey}        9127275    19542           0
{o_orderdate}      9127275    731             0
{o_orderkey}       9127275    92088           0
{r_name}           9127275    1               0
{r_regionkey}      9127275    1               0
~~~~
column_names       row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{c_custkey}        9054728.00     1.01           99406.00            5.09 <==            0.00            1.00
{c_nationkey}      9054728.00     1.01           25.00               5.00 <==            0.00            1.00
{l_discount}       9054728.00     1.01           11.00               1.00                0.00            1.00
{l_extendedprice}  9054728.00     1.01           925903.00           3.09 <==            0.00            1.00
{l_orderkey}       9054728.00     1.01           451701.00           4.91 <==            0.00            1.00
{l_partkey}        9054728.00     1.01           199241.00           1.19                0.00            1.00
{l_suppkey}        9054728.00     1.01           9920.00             1.00                0.00            1.00
{n_name}           9054728.00     1.01           25.00               1.00                0.00            1.00
{n_nationkey}      9054728.00     1.01           25.00               5.00 <==            0.00            1.00
{n_nationkey_1}    9054728.00     1.01           25.00               1.00                0.00            1.00
{n_regionkey}      9054728.00     1.01           1.00                1.00                0.00            1.00
{o_custkey}        9054728.00     1.01           99406.00            5.09 <==            0.00            1.00
{o_orderdate}      9054728.00     1.01           731.00              1.00                0.00            1.00
{o_orderkey}       9054728.00     1.01           451701.00           4.91 <==            0.00            1.00
{r_name}           9054728.00     1.01           1.00                1.00                0.00            1.00
{r_regionkey}      9054728.00     1.01           1.00                1.00                0.00            1.00

stats table=q8_scan_9
----
column_names       row_count  distinct_count  null_count
{l_discount}       6001215    11              0
{l_extendedprice}  6001215    925955          0
{l_orderkey}       6001215    1527270         0
{l_partkey}        6001215    199241          0
{l_suppkey}        6001215    9920            0
~~~~
column_names       row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{l_discount}       6001215.00     1.00           11.00               1.00                0.00            1.00
{l_extendedprice}  6001215.00     1.00           925955.00           1.00                0.00            1.00
{l_orderkey}       6001215.00     1.00           1527270.00          1.00                0.00            1.00
{l_partkey}        6001215.00     1.00           199241.00           1.00                0.00            1.00
{l_suppkey}        6001215.00     1.00           9920.00             1.00                0.00            1.00

stats table=q8_inner_join_10
----
column_names     row_count  distinct_count  null_count
{c_custkey}      2279475    19542           0
{c_nationkey}    2279475    5               0
{n_name}         2279475    25              0
{n_nationkey_1}  2279475    25              0
{n_nationkey}    2279475    5               0
{n_regionkey}    2279475    1               0
{o_custkey}      2279475    19542           0
{o_orderdate}    2279475    731             0
{o_orderkey}     2279475    92088           0
{r_name}         2279475    1               0
{r_regionkey}    2279475    1               0
~~~~
column_names     row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{c_custkey}      2304369.00     1.01           99406.00            5.09 <==            0.00            1.00
{c_nationkey}    2304369.00     1.01           25.00               5.00 <==            0.00            1.00
{n_name}         2304369.00     1.01           25.00               1.00                0.00            1.00
{n_nationkey}    2304369.00     1.01           25.00               5.00 <==            0.00            1.00
{n_nationkey_1}  2304369.00     1.01           25.00               1.00                0.00            1.00
{n_regionkey}    2304369.00     1.01           1.00                1.00                0.00            1.00
{o_custkey}      2304369.00     1.01           99406.00            5.09 <==            0.00            1.00
{o_orderdate}    2304369.00     1.01           731.00              1.00                0.00            1.00
{o_orderkey}     2304369.00     1.01           451701.00           4.91 <==            0.00            1.00
{r_name}         2304369.00     1.01           1.00                1.00                0.00            1.00
{r_regionkey}    2304369.00     1.01           1.00                1.00                0.00            1.00

stats table=q8_inner_join_11
----
column_names     row_count  distinct_count  null_count
{c_custkey}      748800     30253           0
{c_nationkey}    748800     5               0
{n_name}         748800     25              0
{n_nationkey_1}  748800     25              0
{n_nationkey}    748800     5               0
{n_regionkey}    748800     1               0
{r_name}         748800     1               0
{r_regionkey}    748800     1               0
~~~~
column_names     row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{c_custkey}      750000.00      1.00           147944.00           4.89 <==            0.00            1.00
{c_nationkey}    750000.00      1.00           25.00               5.00 <==            0.00            1.00
{n_name}         750000.00      1.00           25.00               1.00                0.00            1.00
{n_nationkey}    750000.00      1.00           25.00               5.00 <==            0.00            1.00
{n_nationkey_1}  750000.00      1.00           25.00               1.00                0.00            1.00
{n_regionkey}    750000.00      1.00           1.00                1.00                0.00            1.00
{r_name}         750000.00      1.00           1.00                1.00                0.00            1.00
{r_regionkey}    750000.00      1.00           1.00                1.00                0.00            1.00

stats table=q8_lookup_join_12
----
column_names   row_count  distinct_count  null_count
{c_custkey}    29952      30253           0
{c_nationkey}  29952      5               0
{n_nationkey}  29952      5               0
{n_regionkey}  29952      1               0
{r_name}       29952      1               0
{r_regionkey}  29952      1               0
~~~~
column_names   row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{c_custkey}    30000.00       1.00           27672.00            1.09                0.00            1.00
{c_nationkey}  30000.00       1.00           5.00                1.00                0.00            1.00
{n_nationkey}  30000.00       1.00           5.00                1.00                0.00            1.00
{n_regionkey}  30000.00       1.00           1.00                1.00                0.00            1.00
{r_name}       30000.00       1.00           1.00                1.00                0.00            1.00
{r_regionkey}  30000.00       1.00           1.00                1.00                0.00            1.00

stats table=q8_merge_join_13
----
column_names   row_count  distinct_count  null_count
{n_nationkey}  5          5               0
{n_regionkey}  5          1               0
{r_name}       5          1               0
{r_regionkey}  5          1               0
~~~~
column_names   row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{n_nationkey}  5.00           1.00           5.00                1.00                0.00            1.00
{n_regionkey}  5.00           1.00           1.00                1.00                0.00            1.00
{r_name}       5.00           1.00           1.00                1.00                0.00            1.00
{r_regionkey}  5.00           1.00           1.00                1.00                0.00            1.00

stats table=q8_select_14
----
column_names   row_count  distinct_count  null_count
{r_name}       1          1               0
{r_regionkey}  1          1               0
~~~~
column_names   row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{r_name}       1.00           1.00           1.00                1.00                0.00            1.00
{r_regionkey}  1.00           1.00           1.00                1.00                0.00            1.00

stats table=q8_scan_15
----
column_names   row_count  distinct_count  null_count
{r_name}       5          5               0
{r_regionkey}  5          5               0
~~~~
column_names   row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{r_name}       5.00           1.00           5.00                1.00                0.00            1.00
{r_regionkey}  5.00           1.00           5.00                1.00                0.00            1.00

stats table=q8_scan_16
----
column_names   row_count  distinct_count  null_count
{n_nationkey}  25         25              0
{n_regionkey}  25         5               0
~~~~
column_names   row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{n_nationkey}  25.00          1.00           25.00               1.00                0.00            1.00
{n_regionkey}  25.00          1.00           5.00                1.00                0.00            1.00

stats table=q8_scan_17
----
column_names   row_count  distinct_count  null_count
{n_name}       25         25              0
{n_nationkey}  25         25              0
~~~~
column_names   row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{n_name}       25.00          1.00           25.00               1.00                0.00            1.00
{n_nationkey}  25.00          1.00           25.00               1.00                0.00            1.00

stats table=q8_select_18
----
column_names   row_count  distinct_count  null_count
{o_custkey}    457263     97345           0
{o_orderdate}  457263     731             0
{o_orderkey}   457263     463903          0
~~~~
column_names   row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{o_custkey}    454558.00      1.01           99406.00            1.02                0.00            1.00
{o_orderdate}  454558.00      1.01           731.00              1.00                0.00            1.00
{o_orderkey}   454558.00      1.01           454558.00           1.02                0.00            1.00

stats table=q8_scan_19
----
column_names   row_count  distinct_count  null_count
{o_custkey}    1500000    99846           0
{o_orderdate}  1500000    2406            0
{o_orderkey}   1500000    1527270         0
~~~~
column_names   row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{o_custkey}    1500000.00     1.00           99846.00            1.00                0.00            1.00
{o_orderdate}  1500000.00     1.00           2406.00             1.00                0.00            1.00
{o_orderkey}   1500000.00     1.00           1500000.00          1.02                0.00            1.00

stats table=q8_scan_20
----
column_names   row_count  distinct_count  null_count
{s_nationkey}  10000      25              0
{s_suppkey}    10000      9920            0
~~~~
column_names   row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{s_nationkey}  10000.00       1.00           25.00               1.00                0.00            1.00
{s_suppkey}    10000.00       1.00           9920.00             1.00                0.00            1.00

stats table=q8_select_21
----
column_names  row_count  distinct_count  null_count
{p_partkey}   1451       1451            0
{p_type}      1451       1               0
~~~~
column_names  row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{p_partkey}   1333.00        1.09           1333.00             1.09                0.00            1.00
{p_type}      1333.00        1.09           1.00                1.00                0.00            1.00

stats table=q8_scan_22
----
column_names  row_count  distinct_count  null_count
{p_partkey}   200000     199241          0
{p_type}      200000     150             0
~~~~
column_names  row_count_est  row_count_err  distinct_count_est  distinct_count_err  null_count_est  null_count_err
{p_partkey}   200000.00      1.00           199241.00           1.00                0.00            1.00
{p_type}      200000.00      1.00           150.00              1.00                0.00            1.00
