Skip to content

TPCC prepares progress to obtain different plan digests for the same SQL. #47634

@King-Dylan

Description

@King-Dylan

Bug Report

Run tiup tpcc preapre will get different plandigests for the same SQL.

1. Minimal reproduce step (Required)

tiup prepare and check the slow query log.

SELECT
  count(*)
FROM
  (
    SELECT
      c.c_id,
      c.c_d_id,
      c.c_w_id,
      c.c_balance c1,
      (
        SELECT
          sum(ol_amount)
        FROM
          orders,
          order_line
        WHERE
          OL_W_ID = O_W_ID
          AND OL_D_ID = O_D_ID
          AND OL_O_ID = O_ID
          AND OL_DELIVERY_D IS NOT NULL
          AND O_W_ID = ?
          AND O_D_ID = c.C_D_ID
          AND O_C_ID = c.C_ID
      ) sm,
      (
        SELECT
          sum(h_amount)
        FROM
          history
        WHERE
          H_C_W_ID = ?
          AND H_C_D_ID = c.C_D_ID
          AND H_C_ID = c.C_ID
      ) smh
    FROM
      customer c
    WHERE
      c.c_w_id = ?
  ) t
WHERE
  c1 <> sm - smh

2. What did you expect to see? (Required)

With the same plandigest

3. What did you see instead (Required)

Got the different plandigest

4. What is your TiDB version? (Required)

v7.4.0

Metadata

Metadata

Labels

affects-6.1This bug affects the 6.1.x(LTS) versions.affects-6.5This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.report/communityThe community has encountered this bug.severity/majorsig/plannerSIG: Plannertype/bugThe issue is confirmed as a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions