Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tpcc: the sql of checkCondition10 is inefficient #176

Open
starxchina opened this issue Jun 17, 2024 · 0 comments
Open

tpcc: the sql of checkCondition10 is inefficient #176

starxchina opened this issue Jun 17, 2024 · 0 comments

Comments

@starxchina
Copy link

starxchina commented Jun 17, 2024

the follow sql is not efficient when I check the data.

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 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant