[MDEV-28038] Why is there a big gap in the actual Table space? (calculated vs information_schema vs file size) Created: 2022-03-11 Updated: 2022-03-11 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Server, Storage Engine - InnoDB |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Nuno | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||
| Description |
|
I have a InnoDB table with the following columns: `BIGINT` -> 8 bytes = 24 bytes per row It contains 10454004 rows (based on COUNT This table's `PRIMARY` key is `BIGINT`, `BIGINT`, `ENUM`. Based on `information_schema`, Also, `AVG_ROW_LENGTH` = 87 instead of 24 And then I look at the actual `.ibd` file size, which is reported as: I understand there is fragmentation and sparse files in question (the records on this table are regularly expired, but never had a bigger retention time than currently is). Goes from 250MB of real calculable data, to 530MiB of Data. And 848 MB reported by `information_schema` (which per my understanding includes "free space" as well), much lower than the actual `.ibd` file. *What am I missing or not considering?* |
| Comments |
| Comment by Marko Mäkelä [ 2022-03-11 ] | |||||||||
|
nunop, thank you for the report. This could be related to Can you provide some SQL for reproducing this? It can be smaller, and I think that it can mostly be dummy data. What could be relevant is the number of pages, so it could be useful to set innodb_page_size=4k for reproducing this inconsistency while using less data. You could use | |||||||||
| Comment by Nuno [ 2022-03-11 ] | |||||||||
|
marko - thank you for the answer and references. I said above that the records on this table are regularly expired. Every day, there are new records being inserted all the time, and then once a day, old records deleted.
> Can you provide some SQL for reproducing this? I'm not sure if I can easily provide some SQL that will visibly reproduce this. Basically we have LOADS of INSERT queries every day, adding random: UID, TID, fst=1 or 2, ls=UNIX_TIMESTAMP() Once a day, DELETE from this table where ls < 5 months. Hope this makes sense. Thank you very much. |