[MDEV-28532] Keylookup with bitmask Created: 2022-05-10 Updated: 2022-05-11 Resolved: 2022-05-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.3.34 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Michael | Assignee: | Daniel Black |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Debian 10 |
||
| Description |
|
Keylookup with Bitmask is slower than it could be Create a big Table with normal key on tinyint column status select * from table where status &7 = 2 |
| Comments |
| Comment by Daniel Black [ 2022-05-11 ] |
|
Generally (expression on column) = constant will need to evaluate the expression for each row in the table. No index optimizations on the column can be made. While the "status in ..." is an alternate, as an unbound list is rather cumbersome. While the optimizer does re-write some simple expressions its obviously not the case with bitmasks. The alternative following dominate sql pattern to put a single value into a column being |
| Comment by Michael [ 2022-05-11 ] |
|
Never heard before of generated columns, CREATE TABLE blah ( PLS close this task |
| Comment by Daniel Black [ 2022-05-11 ] |
|
You're welcome. Happy SQLing. |