-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: modify join query so it's supported by opt #27721
Conversation
Minor rewrite of a TPCC query so it's supported by the optimizer. This is the query which requires lookup join and the optimizer does choose that plan. Release note: None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any concern we impacted TPCC perf with this alternate query form?
Reviewable status: complete! 1 of 0 LGTMs obtained
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any concern we impacted TPCC perf with this alternate query form?
This is a rare query (something like <1% of the queries) and the switch from a single count-distinct operator to a distinct and then a count operator feels like it would get lost in the noise. That's a guess, though. Running tpcc-bench before and after wouldn't hurt. Or perhaps just let @nvanbenschoten know.
Reviewable status: complete! 1 of 0 LGTMs obtained
Yes, this is a rare transaction so I don't expect it to alter perf. Still, I'd like to see a comparison between the old and the new query before making the change. You can run with |
I will run that. But I assume I need to fist run the default "mix" for a while to populate the database with data? Or is there some already populated backup I can restore? |
I ran in various configurations on a local single-node. Not much of a difference.
As a sanity check I turned off the optimizer and the experimental lookup flag and that is much slower:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for verifying the impact of this.
Reviewable status: complete! 1 of 0 LGTMs obtained (and 1 stale)
bors r+ |
27721: tpcc: modify join query so it's supported by opt r=RaduBerinde a=RaduBerinde Minor rewrite of a TPCC query so it's supported by the optimizer. This is the query which requires lookup join and the optimizer does choose that plan. Release note: None I ran with `--wait=false` against a cluster. I also found an instance with `SHOW QUERIES` and ran `EXPLAIN` to make sure it's a plan with lookup-join. Co-authored-by: Radu Berinde <radu@cockroachlabs.com>
Build succeeded |
Minor rewrite of a TPCC query so it's supported by the optimizer.
This is the query which requires lookup join and the optimizer does
choose that plan.
Release note: None
I ran with
--wait=false
against a cluster. I also found an instance withSHOW QUERIES
and ranEXPLAIN
to make sure it's a plan with lookup-join.