[MDEV-21823] information_schema tables need optimization Created: 2020-02-27 Updated: 2020-05-27 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - RocksDB |
| Affects Version/s: | 10.5.1 |
| Fix Version/s: | 10.5 |
| Type: | Bug | Priority: | Major |
| Reporter: | Philip orleans | Assignee: | Sergei Golubchik |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
linux |
||
| Description |
|
this statement fails in database information_schema |
| Comments |
| Comment by Marko Mäkelä [ 2020-02-27 ] | ||||
|
The INFORMATION_SCHEMA tables are essentially hard-coded views. The data is generated programmatically via an interface that (to my understanding) only allows the whole table contents to be returned. There is a parameter that might allow some filtering, but that one is not used in INFORMATION_SCHEMA.INNODB_%, which I am familiar with. I am not aware of anything that would allow to push down any ranges. To my understanding, INFORMATION_SCHEMA.TABLES is returning the same information that you would get with SHOW TABLES, via the same internal interface (invoking virtual member functions of the handler class to get some data from the storage engines). Regarding AUTO_INCREMENT, you should be aware that there are 2 or 3 different values, as described in MDEV-13094. Have you considered CREATE SEQUENCE ( | ||||
| Comment by Sergei Golubchik [ 2020-03-02 ] | ||||
|
This statement
should only open one table `x`.`y` and not touch anything else, there is no full table scan there, | ||||
| Comment by Philip orleans [ 2020-03-02 ] | ||||
|
The optimizer says that "select max(id) from table" is "optimized away" when "id" is the primary key. But, strange enough, | ||||
| Comment by Sergei Golubchik [ 2020-03-02 ] | ||||
|
you can do in two steps, like
To do it in one step you can try creating a stored function like
And may be it'll help, if used like
|