Skip to content

Improve performance of %pat% (>3x speedup)#2521

Merged
tustvold merged 2 commits into
apache:masterfrom
Dandandan:speedup-contains
Aug 19, 2022
Merged

Improve performance of %pat% (>3x speedup)#2521
tustvold merged 2 commits into
apache:masterfrom
Dandandan:speedup-contains

Conversation

@Dandandan

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #2519

Rationale for this change

LIKE %pat% is something that occurs a lot in SQL queries. It's also one of the slower queries in the ClickBench benchmarks.

Results:

like_utf8 scalar contains                        
                        time:   [1.9803 ms 1.9828 ms 1.9853 ms]
                        change: [-71.755% -71.321% -70.997%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) low mild
  2 (2.00%) high mild

Benchmarking nlike_utf8 scalar contains: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 9.9s, enable flat sampling, or reduce sample count to 40.
Benchmarking nlike_utf8 scalar contains: Collecting 100 samples in estimated 9.9                                                                                nlike_utf8 scalar contains                        
                        time:   [1.9413 ms 1.9448 ms 1.9488 ms]
                        change: [-71.544% -71.455% -71.344%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
  1 (1.00%) low mild
  6 (6.00%) high mild
  3 (3.00%) high severe

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions Bot added the arrow Changes to the arrow crate label Aug 19, 2022
@tustvold

Copy link
Copy Markdown
Contributor

Very nice 👍

@tustvold tustvold merged commit e80f647 into apache:master Aug 19, 2022
@ursabot

ursabot commented Aug 19, 2022

Copy link
Copy Markdown

Benchmark runs are scheduled for baseline = b3fd4bd and contender = e80f647. e80f647 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

}
}
} else if right.starts_with('%')
&& right.ends_with('%')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

like supports escape characters now (#2258), so I think this also needs to check that the string does not end with '\%'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Speed up like_utf8_scalar for %pat%

4 participants