[MDEV-20492] Information schema query producing many disk temp table Created: 2019-09-04 Updated: 2022-11-22 Resolved: 2019-11-25 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Information Schema |
| Affects Version/s: | 10.3.16 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | VAROQUI Stephane | Assignee: | Oleksandr Byelkin |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||
| Description |
|
On slow SATA disk our monitoring API try to compute CRC32 of DDL using information schema Such trivial queries piling in processlist up to 40s , and so guessing a table lock is hold for the same duration . Profiling show the time is spend in removing temp tables
Found a workaround by using show create table instead but i d like to understand why information_schema produce multiple on disk temp tables , any pointer would be appreciate , thanks i advance . Found that changing join level from 6 to 2 change from BNLH to (flat, BNL ) and reduce the number of temp table per 2 . Still so few rows should not produce disk temp table but memory instead no ? |
| Comments |
| Comment by Oleksandr Byelkin [ 2019-10-11 ] | |||||||||||||||||||||||||||||||||||
|
Where is bug here? | |||||||||||||||||||||||||||||||||||
| Comment by VAROQUI Stephane [ 2019-10-11 ] | |||||||||||||||||||||||||||||||||||
|
Hi Oleksander, why a 6 records query on IS produce 10 disk temp table the memory use should be less than a 1Kb | |||||||||||||||||||||||||||||||||||
| Comment by VAROQUI Stephane [ 2019-10-11 ] | |||||||||||||||||||||||||||||||||||
|
The issue is that most monitoring tools will not really look at what mariadb does behind the hood and clients may simply switch to MysQL 8.0 using innodb table dictionary without even understand that the monyog is just killing their disk ! | |||||||||||||||||||||||||||||||||||
| Comment by VAROQUI Stephane [ 2019-10-11 ] | |||||||||||||||||||||||||||||||||||
|
I not sure about what is thae case here but why do i receive such jira ticket "Anyways, additional question would your pro (or osc relase) version allow a real time/live migration from MariaDB 10.2 to MySQL 7/8?" | |||||||||||||||||||||||||||||||||||
| Comment by VAROQUI Stephane [ 2019-10-11 ] | |||||||||||||||||||||||||||||||||||
|
I don't like to hear this , and i'd like to help founding why this happen | |||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2019-10-14 ] | |||||||||||||||||||||||||||||||||||
|
My first guess would be that the I_S code does not realize you're selecting data only for one table from I_S.KEY_COLUMN_USAGE.
Just to see if that helps, I'm not saying you should do it in production. | |||||||||||||||||||||||||||||||||||
| Comment by VAROQUI Stephane [ 2019-10-15 ] | |||||||||||||||||||||||||||||||||||
|
Hi Sergei, good to hear from you ! You guys make my day with insert returning The issue can be narrow to data type of COLUMNS metadata:
While data type choice can be questioned for those columns : can ENUM definition of longtext may exeed varchar max ? , i can't imagine a default or generated exxpression so long Still we get on simple query:
here NOT using
Where does disk temp table comes in ? Tx svar Thanks stephane | |||||||||||||||||||||||||||||||||||
| Comment by VAROQUI Stephane [ 2019-10-15 ] | |||||||||||||||||||||||||||||||||||
|
By creating same table in aria instead of memory the disk temporay table is not created | |||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2019-10-16 ] | |||||||||||||||||||||||||||||||||||
|
on-disk temporary table is created to store the values of `column_type` column. because MEMORY tables cannot have BLOB columns, as you know. | |||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2019-11-25 ] | |||||||||||||||||||||||||||||||||||
|
This is not a bug, everything works as intended. We want to optimize that in the future and not create temp tables in this case. But still, it's not a bug. | |||||||||||||||||||||||||||||||||||
| Comment by VAROQUI Stephane [ 2019-11-25 ] | |||||||||||||||||||||||||||||||||||
|
Thanks i did not know every request to information_schema produce extra memory table as middle man resultset i was just thinking the data can flow from memory to thread result buffer directly, if not the case of course that's not a bug | |||||||||||||||||||||||||||||||||||
| Comment by VAROQUI Stephane [ 2019-11-25 ] | |||||||||||||||||||||||||||||||||||
|
Also Monty told me once, aria was now used for temporary tables to avoid touching the disks, was just curious to notice it's not case for IS as well as this make monitoring from IS almost a no go ! | |||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2019-11-25 ] | |||||||||||||||||||||||||||||||||||
|
Yes, every request to information_schema produces a temporary table. If all requested columns are supported by the MEMORY engine then the table is created using MEMORY engine. But if there are blob columns, the engine will be Aria. Aria temporary tables don't necessarily go to disk, as far as I understand. They can stay in the page cache and then these pages can be discarded when a table is dropped without ever being written to disk. But if the page cache will need to free some pages, it might write temp table pages to disk. |