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

apply table projections through Distinct nodes #2796

Merged
merged 5 commits into from
Dec 19, 2024
Merged

apply table projections through Distinct nodes #2796

merged 5 commits into from
Dec 19, 2024

Conversation

jycor
Copy link
Contributor

@jycor jycor commented Dec 18, 2024

We weren't pruning table columns when there was a distinct clause over the projections, this resulted the deserialization of every column, even if they weren't going to make it to the result. This is bad for performance, especially if the unread columns are of TEXT, LONGTEXT, 'BLOB, LONGBLOB` type as those are stored out of band, and take longer to deserialize.

fixes: dolthub/dolt#8689

Copy link
Contributor

@max-hoffman max-hoffman left a comment

Choose a reason for hiding this comment

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

LGTM, we have associated tests for the anti join change?

if rt, ok := ta.Child.(*plan.ResolvedTable); ok {
if t := rt.UnderlyingTable(); t != nil {
if pt, ok := t.(sql.ProjectedTable); ok {
tmpTbl := pt.WithProjections(nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

sql.PrimaryKeyTable is how we do this in other places, i'm pretty sure the memo RelProps has this already

@jycor jycor merged commit 701e962 into main Dec 19, 2024
8 checks passed
@jycor jycor deleted the james/distinct branch December 19, 2024 00:26
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.

Prune columns from select distinct
2 participants