Skip to content

colexec: optimize CASE, AND, and OR projection operators#62925

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
yuzefovich:vec-and-or
Apr 1, 2021
Merged

colexec: optimize CASE, AND, and OR projection operators#62925
craig[bot] merged 1 commit intocockroachdb:masterfrom
yuzefovich:vec-and-or

Conversation

@yuzefovich
Copy link
Copy Markdown
Member

Previously, in CASE, AND, and OR projection operators we would always
allocate internal selection vectors of maximum capacity in the
constructor. This is inefficient when the query processes only small
data sets. This commit makes the allocations lazy and of tight sizes
based on the batch lengths.

Addresses: #62212

Release note: None

@yuzefovich yuzefovich requested review from a team and jordanlewis April 1, 2021 01:57
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Collaborator

@rytaft rytaft left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 3 of 3 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @jordanlewis)

Copy link
Copy Markdown
Contributor

@cucaroach cucaroach left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 3 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @jordanlewis and @yuzefovich)


pkg/sql/colexec/and_or_projection_tmpl.go, line 170 at r1 (raw file):

			o.origSel = o.origSel[:origLen]
		}
		copy(o.origSel, sel)

Should we encapsulate this pattern in a helper? 3 times is usually enough for me to pull the trigger.

Previously, in CASE, AND, and OR projection operators we would always
allocate internal selection vectors of maximum capacity in the
constructor. This is inefficient when the query processes only small
data sets. This commit makes the allocations lazy and of tight sizes
based on the batch lengths.

Release note: None
Copy link
Copy Markdown
Member Author

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

TFTRs!

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @cucaroach, @jordanlewis, and @rytaft)


pkg/sql/colexec/and_or_projection_tmpl.go, line 170 at r1 (raw file):

Previously, cucaroach (Tommy Reilly) wrote…

Should we encapsulate this pattern in a helper? 3 times is usually enough for me to pull the trigger.

Good point, done.

Copy link
Copy Markdown
Contributor

@cucaroach cucaroach left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 4 of 4 files at r2.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (and 1 stale) (waiting on @jordanlewis)

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Apr 1, 2021

Build succeeded:

@craig craig bot merged commit 1764c5f into cockroachdb:master Apr 1, 2021
@yuzefovich yuzefovich deleted the vec-and-or branch April 1, 2021 21:27
@rafiss rafiss added this to the 21.1 milestone Apr 22, 2021
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.

5 participants