Details
-
Task
-
Status: Closed (View Workflow)
-
Blocker
-
Resolution: Fixed
-
10.2.2-2, 10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-3, 10.2.2-4, 10.2.3-1, 10.2.3-2
Description
Would it be possible to make DATE() on datetime column sargable in some cases?
Like rewrite "DATE(col) = const" to "col BETWEEN concat(const, ' 00:00:00') AND concat(const, ' 23:59:59')"
Other similar cases:
- "YEAR(col) = const" is almost the same
- "YEAR(col) = c1 AND MONTH(col) = c2" and other such combinations may be too complex to be worth it.
Attachments
Issue Links
- causes
-
MDEV-30901 Index usage for DATE(datetime_column) = const does not work for engine Memory
-
- Closed
-
-
MDEV-30913 Index usage for DATE(datetime_column) = const does not work for engine Connect
-
- Closed
-
-
MDEV-30946 Index usage for DATE(datetime_column) = const does not work for DELETE and UPDATE
-
- Closed
-
-
MDEV-33299 Assertion `(tm->tv_usec % (int) log_10_int[6 - dec]) == 0' failed in void my_timestamp_to_binary(const timeval*, uchar*, uint)
-
- Closed
-
- is duplicated by
-
MDEV-8937 Optimize date functions in the parser
-
- Closed
-
- relates to
-
MDEV-30930 Make more date conditions sargable
-
- Open
-
-
MDEV-14635 Convert date operations on indexed column to sargable equivalents where possible
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Description |
Would it be possible to make DATE() on datetime column sargable in some cases? Like rewrite "DATE(col) = const" to "col BETWEEN concat(const, ' 00:00:00' AND concat(const, ' 23:59:59'" Other similar cases: - "YEAR(col) = const" is almost the same - "YEAR(col) = c1 AND MONTH(col) = c2" and other such combinations may be too complex to be worth it. |
Would it be possible to make DATE() on datetime column sargable in some cases? Like rewrite "DATE(col) = const" to "col BETWEEN concat(const, ' 00:00:00' AND concat(const, ' 23:59:59')" Other similar cases: - "YEAR(col) = const" is almost the same - "YEAR(col) = c1 AND MONTH(col) = c2" and other such combinations may be too complex to be worth it. |
Description |
Would it be possible to make DATE() on datetime column sargable in some cases? Like rewrite "DATE(col) = const" to "col BETWEEN concat(const, ' 00:00:00' AND concat(const, ' 23:59:59')" Other similar cases: - "YEAR(col) = const" is almost the same - "YEAR(col) = c1 AND MONTH(col) = c2" and other such combinations may be too complex to be worth it. |
Would it be possible to make DATE() on datetime column sargable in some cases? Like rewrite "DATE(col) = const" to "col BETWEEN concat(const, ' 00:00:00') AND concat(const, ' 23:59:59')" Other similar cases: - "YEAR(col) = const" is almost the same - "YEAR(col) = c1 AND MONTH(col) = c2" and other such combinations may be too complex to be worth it. |
Summary | FR: allow index usage for DATE(datetime_column) = const | Allow index usage for DATE(datetime_column) = const |
Assignee | Sergei Petrunia [ psergey ] |
Fix Version/s | 10.2 [ 14601 ] |
Assignee | Sergei Petrunia [ psergey ] | Alexey Botchkov [ holyfoot ] |
Sprint | 10.2.2-2 [ 82 ] |
Rank | Ranked lower |
Status | Open [ 1 ] | In Progress [ 3 ] |
Sprint | 10.2.2-2 [ 82 ] | 10.2.2-2, 10.2.2-3 [ 82, 83 ] |
Status | In Progress [ 3 ] | Stalled [ 10000 ] |
Status | Stalled [ 10000 ] | In Progress [ 3 ] |
Sprint | 10.2.2-2, 10.2.2-3 [ 82, 83 ] | 10.2.2-2, 10.2.2-3, 10.2.2-1 [ 82, 83, 89 ] |
Rank | Ranked higher |
Sprint | 10.2.2-2, 10.2.2-3, 10.2.2-1 [ 82, 83, 89 ] | 10.2.2-2, 10.2.2-3, 10.2.2-1, 10.2.2-2 [ 82, 83, 89, 92 ] |
Rank | Ranked lower |
Sprint | 10.2.2-2, 10.2.2-3, 10.2.2-1, 10.2.2-2 [ 82, 83, 89, 92 ] | 10.2.2-2, 10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-3 [ 82, 83, 89, 92, 94 ] |
Sprint | 10.2.2-2, 10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-3 [ 82, 83, 89, 92, 94 ] | 10.2.2-2, 10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-3, 10.2.2-4 [ 82, 83, 89, 92, 94, 96 ] |
Assignee | Alexey Botchkov [ holyfoot ] | Sergei Petrunia [ psergey ] |
Status | In Progress [ 3 ] | In Review [ 10002 ] |
Sprint | 10.2.2-2, 10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-3, 10.2.2-4 [ 82, 83, 89, 92, 94, 96 ] | 10.2.2-2, 10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-3, 10.2.2-4, 10.2.3-1 [ 82, 83, 89, 92, 94, 96, 102 ] |
Rank | Ranked lower |
Sprint | 10.2.2-2, 10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-3, 10.2.2-4, 10.2.3-1 [ 82, 83, 89, 92, 94, 96, 102 ] | 10.2.2-2, 10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-3, 10.2.2-4, 10.2.3-1, 10.2.3-2 [ 82, 83, 89, 92, 94, 96, 102, 105 ] |
Fix Version/s | 10.3 [ 22126 ] | |
Fix Version/s | 10.2 [ 14601 ] |
Assignee | Sergei Petrunia [ psergey ] | Alexander Barkov [ bar ] |
Assignee | Alexander Barkov [ bar ] | Sergei Petrunia [ psergey ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Link |
This issue relates to |
Fix Version/s | 10.3 [ 22126 ] |
Workflow | MariaDB v3 [ 70012 ] | MariaDB v4 [ 131651 ] |
Assignee | Sergei Petrunia [ psergey ] | Oleg Smirnov [ JIRAUSER50405 ] |
Fix Version/s | 11.1 [ 28549 ] |
Status | Stalled [ 10000 ] | In Progress [ 3 ] |
Assignee | Oleg Smirnov [ JIRAUSER50405 ] | Sergei Petrunia [ psergey ] |
Status | In Progress [ 3 ] | In Review [ 10002 ] |
Link | This issue relates to TODO-3816 [ TODO-3816 ] |
Link | This issue relates to TODO-3816 [ TODO-3816 ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Assignee | Sergei Petrunia [ psergey ] | Oleg Smirnov [ JIRAUSER50405 ] |
Status | Stalled [ 10000 ] | In Testing [ 10301 ] |
Assignee | Oleg Smirnov [ JIRAUSER50405 ] | Elena Stepanova [ elenst ] |
Assignee | Elena Stepanova [ elenst ] | Lena Startseva [ JIRAUSER50478 ] |
Labels | Preview_11.1 |
Link |
This issue causes |
Link |
This issue causes |
Link | This issue relates to MDEV-30930 [ MDEV-30930 ] |
Link |
This issue causes |
Assignee | Lena Startseva [ JIRAUSER50478 ] | Oleg Smirnov [ JIRAUSER50405 ] |
Status | In Testing [ 10301 ] | Stalled [ 10000 ] |
Priority | Major [ 3 ] | Blocker [ 1 ] |
Fix Version/s | 11.1.1 [ 28704 ] | |
Fix Version/s | 11.1 [ 28549 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Link |
This issue causes |