Skip to content

stats: inconsistent stats after dropping a hash index #618

Description

@adsharma
lbug> call disk_size_info() return *;
┌─────────────┬───────────────────────────────────────────┬───────────┬─────────────┐
│ category    │ name                                      │ num_pages │ size_bytes  │
│ STRING      │ STRING                                    │ UINT64    │ UINT64      │
├─────────────┼───────────────────────────────────────────┼───────────┼─────────────┤
│ header      │ database_header                           │ 1         │ 4096        │
│ catalog     │ catalog                                   │ 1         │ 4096        │
│ metadata    │ metadata                                  │ 783       │ 3207168     │
│ node_table  │ edge_types                                │ 0         │ 0           │
│ node_table  │ edge_meta                                 │ 0         │ 0           │
│ node_table  │ wikidata_node                             │ 1440241   │ 5899227136  │
│ rel_table   │ wikidata_rel:wikidata_node->wikidata_node │ 2140331   │ 8766795776  │
│ free_space  │ free_pages                                │ 1554      │ 6365184     │
│ unaccounted │ unaccounted_pages                         │ 675745    │ 2767851520  │
│ total       │ file_total                                │ 4258656   │ 17443454976 │
└─────────────┴───────────────────────────────────────────┴───────────┴─────────────┘
(10 tuples)
(4 columns)
Time: 7.33ms (compiling), 7.84ms (executing)
lbug> drop index wikidata_node._PK;
┌─────────────────────────────┐
│ result                      │
│ STRING                      │
├─────────────────────────────┤
│ Index _PK has been dropped. │
└─────────────────────────────┘

The unaccounted space is the space taken up by the hash index. This could be improved by:

a) Explicitly adding the _PK hash index to show_indexes()
b) Moving the accounting from unaccounted -> index

After dropping the index, the free space is still low. One has to exit and restart the shell to see the benefit:

lbug> call disk_size_info() return *;
┌────────────┬───────────────────────────────────────────┬───────────┬─────────────┐
│ category   │ name                                      │ num_pages │ size_bytes  │
│ STRING     │ STRING                                    │ UINT64    │ UINT64      │
├────────────┼───────────────────────────────────────────┼───────────┼─────────────┤
│ header     │ database_header                           │ 1         │ 4096        │
│ catalog    │ catalog                                   │ 1         │ 4096        │
│ metadata   │ metadata                                  │ 2102      │ 8609792     │
│ node_table │ wikidata_node                             │ 1440241   │ 5899227136  │
│ index      │ wikidata_node.name_index:tree             │ 1275258   │ 5223456768  │
│ node_table │ edge_meta                                 │ 0         │ 0           │
│ node_table │ edge_types                                │ 0         │ 0           │
│ rel_table  │ wikidata_rel:wikidata_node->wikidata_node │ 2140331   │ 8766795776  │
│ free_space │ free_pages                                │ 680184    │ 2786033664  │
│ total      │ file_total                                │ 5538118   │ 22684131328 │
└────────────┴───────────────────────────────────────────┴───────────┴─────────────┘

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions