[MDEV-16003] too large INDEX_LENGTH Created: 2018-04-24 Updated: 2018-06-05 Resolved: 2018-06-05 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB, Storage Engine - XtraDB |
| Affects Version/s: | 10.1.30 |
| Fix Version/s: | 5.5.59, 10.0.34, 10.2.12, 10.3.4, 10.1.31 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sergey Chernomorets | Assignee: | Marko Mäkelä |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Environment: |
centos 7 |
||
| Issue Links: |
|
||||||||
| Description |
|
We have a table with integer fields, it has too large index space. When I copy data to new table the new table significantly less then origin. Data is append mostly, no update.
How is it possible? Pages fragmentation? |
| Comments |
| Comment by Sergey Chernomorets [ 2018-04-24 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Another table:
In new table index space 10 times lesser:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergey Chernomorets [ 2018-04-24 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
We altered table vacsubscriptions_stat (alter table force) to compact it some days ago, but table still grows. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2018-05-31 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
What exactly bothers you, INDEX_LENGTH or the size of the ibd file on disk? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergey Chernomorets [ 2018-05-31 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
INDEX_LENGTH grows very quickly, I think it very strange. And INDEX_LENGTH reduced more than 10x after copying all data into new table - why indexes consume so many space? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergey Chernomorets [ 2018-05-31 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I tried flush and analyze - no effect:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-06-05 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This should be a duplicate of FLUSH TABLES has no effect inside InnoDB. FLUSH TABLE region.vacsubscriptions_stat FOR EXPORT could have some effect. I assume that the DATA_LENGTH and INDEX_LENGTH are reported in bytes. For the primary key index (clustered index), DATA_LENGTH/TABLE_ROWS is 66.8 bytes, which looks reasonable, because the record payload size should be about 4*11+6+7+5 bytes (6+7 bytes for the hidden fields DB_TRX_ID,DB_ROLL_PTR and 5 bytes for the record header). 62 bytes per record is not much less than the average of 66.8 bytes per row, if we consider the page header and footer that are more than 100 bytes of the default innodb_page_size=16384 bytes. I see that there is only one secondary index on the table. Its record size should be 5+4+4=13 bytes (including the fixed-size header). In InnoDB, the multi-versioning of secondary indexes basically is copy-on-write. Maybe the reason for the growth is that the indexed column is being updated frequently? INDEX_LENGTH/TABLE_ROWS/13 = 76.2. Could each record have an average of more than 70 updates of the date_processed column? Entries in the secondary indexes would be removed by a background process called purge. Due to You would not have to rebuild the whole table; DROP INDEX followed by CREATE INDEX should also work to reduce the index size. But it would not shrink the data file. |