address queries with derived predicates that regressed by 2 orders of magnitude

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • 0
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      As a result of SERVER-127575 disabling predicate duplication in cardinality estimations, some queries have regressed. 

      from plan_stability_tpch_fuzzed.js

      {">>>command": {"aggregate":"lineitem","pipeline":[{"$lookup":{"from":"orders","localField":"l_orderkey","foreignField":"o_orderkey","pipeline":[{"$match":{"$and":[{"o_totalprice":{"$lte":42850.94}}]}}],"as":"orders"}},{"$unwind":"$orders"},{"$lookup":{"from":"customer","localField":"orders.o_custkey","foreignField":"c_custkey","pipeline":[{"$match":{"$nor":[{"c_name":"Customer#000008556"}]}},{"$match":{"$and":[{"c_acctbal":{"$lte":4306.41}}]}}],"as":"customer"}},{"$unwind":"$customer"},{"$lookup":{"from":"supplier","localField":"customer.c_nationkey","foreignField":"s_nationkey","pipeline":[{"$match":{"$and":[{"s_nationkey":0}]}}],"as":"supplier"}},{"$unwind":"$supplier"},{"$match":{"$nor":[{"customer.c_acctbal":{"$gte":-540.14}},{"l_shipmode":{"$in":["MAIL","AIR","REG AIR","FOB","RAIL"]}}]}}],"cursor":{},"idx":83},    "winningPlan": ["HJ s_nationkey = customer.c_nationkey","  -> [supplier] FETCH: plan_stability_tpch_fuzzed.supplier ","      -> IXSCAN: plan_stability_tpch_fuzzed.supplier s_nationkey_1 {'s_nationkey':['[0.0, 0.0]']}","  -> [none] INLJ orders.o_orderkey = l_orderkey","      -> [none] HJ c_custkey = o_custkey","          -> [customer] FETCH: plan_stability_tpch_fuzzed.customer {'$and':[{'c_acctbal':{'$not':{'$gte':-540.14}}},{'c_name':{'$not':{'$eq':'Customer#000008556'}}},{'c_acctbal':{'$lte':4306.41}}]} ","              -> IXSCAN: plan_stability_tpch_fuzzed.customer c_nationkey_1 {'c_nationkey':['[0.0, 0.0]']}","          -> [orders] COLLSCAN: plan_stability_tpch_fuzzed.orders {'o_totalprice':{'$lte':42850.94}} ","      -> [none] FETCH: plan_stability_tpch_fuzzed.lineitem {'l_shipmode':{'$not':{'$in':['AIR','FOB','MAIL','RAIL','REG AIR']}}} ","          -> INDEX_PROBE_NODE: plan_stability_tpch_fuzzed.lineitem l_orderkey_1"],    "keys" :       697,    "docs" :    150697,    "rows" :       468,    "csum" : "769e571e8c5c292e"}, 

      and

      {">>>command": {"aggregate":"part","pipeline":[{"$lookup":{"from":"partsupp","localField":"p_partkey","foreignField":"ps_partkey","pipeline":[{"$match":{"$and":[{"ps_availqty":{"$lt":9935}},{"ps_comment":{"$regex":{"$regex":"^i","$options":""}}}]}},{"$match":{"$or":[{"ps_availqty":{"$lte":9607}},{"ps_availqty":{"$gt":5937}}]}}],"as":"partsupp"}},{"$unwind":"$partsupp"},{"$lookup":{"from":"lineitem","localField":"partsupp.ps_partkey","foreignField":"l_partkey","pipeline":[{"$match":{"$or":[{"l_tax":{"$gt":0}}]}},{"$match":{"$and":[{"l_shipdate":{"$lte":"1996-09-22T00:00:00.000Z"}},{"l_quantity":{"$lte":26}}]}},{"$match":{"$and":[{"l_suppkey":90},{"l_linestatus":{"$in":["F"]}}]}}],"as":"lineitem"}},{"$unwind":"$lineitem"},{"$match":{"$or":[{"partsupp.ps_availqty":{"$lte":4424}},{"p_mfgr":"Manufacturer#4"},{"partsupp.ps_supplycost":{"$eq":164.22}}]}}],"cursor":{},"idx":55},    "winningPlan": ["HJ ps_partkey = p_partkey","  -> [partsupp] COLLSCAN: plan_stability_tpch_fuzzed.partsupp {'$and':[{'$or':[{'ps_availqty':{'$lte':9607}},{'ps_availqty':{'$gt':5937}}]},{'ps_availqty':{'$lt':9935}},{'ps_comment':{'$regex':'^i'}}]} ","  -> [none] COLLSCAN: plan_stability_tpch_fuzzed.part ","$match","$lookup lineitem l_partkey_1"],    "keys" :     77237,    "docs" :    177237,    "rows" :        32,    "csum" : "cfdcd1c75de85b84"}, 

            Assignee:
            Unassigned
            Reporter:
            Maddie Zechar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: