-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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+opt: translate upcasts in comparisons to suitable bound enlargements #27503
Comments
Also optimization is possible for inequalities when the bound has an exact representation in both types! |
#20046 is similar. |
We have marked this issue as stale because it has been inactive for |
still exists in 21.1 |
We have marked this issue as stale because it has been inactive for |
still relevant |
This is something I tripped up against earlier, which I saw @awoods187 trip against, and which Andrew Deally just reported customers trip up on:
select * from sometable where tscol::date = '2018-07-01'
where
tscol
has type TIMESTAMP and is indexed, will (currently) not use an index. This is a major surprise.The workaround is pretty inconvenient, the query must be manually translated to
... where tscol >= '2018-07-01'::timestamp and tscol < '2018-07-02'::timestamp
(which is itself error prone in edge cases like February 28th on leap years etc).
This optimization must be performed for any comparison of the pattern
Val::T = LITERAL
where:Val
Other examples:
where deccol::INT = 123
)but not TIMESTAMP vs INT (no natural conversion) or DECIMAL vs FLOAT (no natural conversion).
Jira issue: CRDB-4951
The text was updated successfully, but these errors were encountered: