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

[memo] assume self-join stats cardinality continuity #2606

Merged
merged 2 commits into from
Jul 26, 2024

Conversation

max-hoffman
Copy link
Contributor

@max-hoffman max-hoffman commented Jul 26, 2024

Self-join stats estimation is particularly expensive because all of the buckets exactly overlap. If the index is unique, the cardinality distribution will not change. If the index is non-unique, the cardinality will expand proportional to rowCount/distinctCount.

before
BenchmarkOltpJoinScan-12    	    1766	    694524 ns/op	  462834 B/op	    8240 allocs/op
after
BenchmarkOltpJoinScan-12    	    2460	    481166 ns/op	  193569 B/op	    7129 allocs/op

sysbench perf here: dolthub/dolt#8159

@nicktobey
Copy link
Contributor

The new file sql/query_props.go seems unusued and not connected to the rest of the PR.

Otherwise, this looks good.

@max-hoffman
Copy link
Contributor Author

Whoops thanks for flagging, didn't mean for that to sneak by me.

@max-hoffman max-hoffman force-pushed the max/self-join-histogram-shortcut branch from a3c3bd8 to e63da52 Compare July 26, 2024 18:22
@max-hoffman max-hoffman merged commit 72470d3 into main Jul 26, 2024
8 checks passed
@max-hoffman max-hoffman deleted the max/self-join-histogram-shortcut branch July 26, 2024 19:28
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

Successfully merging this pull request may close these issues.

2 participants