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

Simplify IS NULL and IS NOT NULL expressions. #2662

Merged
merged 1 commit into from
Sep 25, 2015

Conversation

petermattis
Copy link
Collaborator

Use "a != " and "a IS NOT NULL" expressions to restrict the start
of scan ranges to not include NULL values. Use "a IS NULL" expressions
to restrict the end range to stop at the end of the NULL values.

The code is thorny. I recommend concentrating on the test cases.

See #2636.

@@ -508,7 +545,7 @@ func TestSimplifyOrExprCheck(t *testing.T) {
{`a = 1 OR a = 1`, `a = 1`},
{`a = 1 OR a = 2`, `a IN (1, 2)`},
{`a = 2 OR a = 1`, `a IN (1, 2)`},
{`a = 1 OR a != 1`, `true`},
{`a = 1 OR a != 1`, `a IS NOT NULL`},
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Simplifying a = 1 OR a != 1 to true was a bug. Those expressions are not equivalent if a is NULL. This was caught be the enhancements to checkEquivExpr to test the NULL value in the expressions. Yay tests!

@tamird
Copy link
Contributor

tamird commented Sep 25, 2015

LGTM

Use "a != <val>" and "a IS NOT NULL" expressions to restrict the start
of scan ranges to not include NULL values. Use "a IS NULL" expressions
to restrict the end range to stop at the end of the NULL values.

The code is thorny. I recommend concentrating on the test cases.

See #2636.
@petermattis petermattis force-pushed the pmattis/sql-analyze-is-not-null branch from 30632b8 to 0da471f Compare September 25, 2015 17:12
@tamird
Copy link
Contributor

tamird commented Sep 25, 2015

LGTM

petermattis added a commit that referenced this pull request Sep 25, 2015
…null

Simplify IS NULL and IS NOT NULL expressions.
@petermattis petermattis merged commit f25ce33 into master Sep 25, 2015
@petermattis petermattis deleted the pmattis/sql-analyze-is-not-null branch September 25, 2015 18:24
RaduBerinde added a commit to RaduBerinde/cockroach that referenced this pull request Jun 30, 2023
…598cb059

c0a2ede2 db: improve delete pacing (cockroachdb/pebble#2696)

Informs cockroachdb#2662.

Release justification: fixes very high goroutine count on heavy write
workloads with fast disks.

Release note (bug fix): On heavy write workloads with fast disks, the
deletion of obsolete LSM files could fall behind, causing high
goroutine count. Pacing of obsolete file deletion now adapts based on
recent deletion rate to avoid falling behind.
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