Uploaded image for project: 'Tajo'
  1. Tajo
  2. TAJO-2118

The join cost calculation before join order optimization should be same with that of after optimization

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 0.13.0
    • Component/s: Planner/Optimizer
    • Labels:
      None

      Description

      See the title.
      When you run the below query,

      // TPC-H Q10
      default> select
          c_custkey,
          c_name,
          sum(l_extendedprice * (1 - l_discount)) as revenue,
          c_acctbal,
          n_name,
          c_address,
          c_phone,
          c_comment
      from
          customer as c
          join nation as n
              on c.c_nationkey = n.n_nationkey
          join orders as o
              on c.c_custkey = o.o_custkey and o.o_orderdate >= '1993-10-01'::date and o.o_orderdate < '1994-01-01'::date
          join lineitem as l
              on l.l_orderkey = o.o_orderkey and l.l_returnflag = 'R'
      group by
          c_custkey, c_name, c_acctbal, c_phone, n_name, c_address, c_comment
      order by
          revenue desc
      

      you can find the below log. The cost of before optimization is smaller than that after optimization. This is because the different cost calculation methods are used for each unoptimized and optimized plans.

      ...
      Query Block Graph
      -----------------------------
      |-#ROOT
      -----------------------------
      Optimization Log:
      [#ROOT]
              > Non-optimized join order: (((default.customer200 ⋈θ default.nation200) ⋈θ default.orders200) ⋈θ default.lineitem200) (cost: 3.19186301858328E32)
              > Optimized join order    : ((default.lineitem200 ⋈θ default.orders200) ⋈θ (default.customer200 ⋈θ default.nation200)) (cost: 1.0772537685263547E33)
      -----------------------------
      ...
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jihoonson Jihoon Son
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: