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

sql/analyzer/indexes.go: Avoid N^2 behavior in index merge for large indexed InTuple expressions. #358

Merged
merged 1 commit into from Apr 7, 2021

Conversation

reltuk
Copy link
Contributor

@reltuk reltuk commented Apr 5, 2021

No description provided.

@reltuk
Copy link
Contributor Author

reltuk commented Apr 5, 2021

This improves the behavior reported here: dolthub/dolt#1511. For example:

$ time dolt sql < query_2000.sql
+----+-------+
| pk | value |
+----+-------+
| 1  | 1     |
| 2  | 2     |
+----+-------+
Rows inserted: 0 Rows updated: 0 Rows deleted: 0
dolt sql < query_2000.sql  0.10s user 0.04s system 67% cpu 0.213 total

There are still potential improvements here. For large result sets, we still evaluate the n entries in the tuple for each row when evaluating the expression as part of a projection or filter expression, for example.

Copy link
Member

@zachmu zachmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@reltuk reltuk merged commit 09edec9 into master Apr 7, 2021
@Hydrocharged Hydrocharged deleted the aaron/in-better-asymptotics branch December 8, 2021 07:07
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.

None yet

2 participants