在 Neo4j 中计算索引大小的方法。
如果需要出于容量规划目的计算 Neo4j 中索引的大小,则可以使用两种方法。
1) 执行 db.indexes()
过程
CALL db.indexes() YIELD id, name, labelsOrTypes, properties;
从该输出中,您可以获取 id
neo4j@customers> CALL db.indexes() YIELD id, name, labelsOrTypes, properties;
+--------------------------------------------+
| id | name | labelsOrTypes | properties |
+--------------------------------------------+
| 1 | "kb_idx" | ["Movie"] | ["idd"] |
+--------------------------------------------+
1 row available after 49 ms, consumed after another 5 ms
这里的 id
是 1。通过执行没有参数的过程,将返回更完整的列表,包括 state
call db.indexes();
+-------------------------------------------------------------------------------------------------------------------------------------+
| id | name | state | populationPercent | uniqueness | type | entityType | labelsOrTypes | properties | provider |
+-------------------------------------------------------------------------------------------------------------------------------------+
| 1 | "kb_idx" | "ONLINE" | 100.0 | "NONUNIQUE" | "BTREE" | "NODE" | ["Movie"] | ["idd"] | "native-btree-1.0" |
+-------------------------------------------------------------------------------------------------------------------------------------+
1 row available after 49 ms, consumed after another 2 ms
现在您有了 id
,您可以在 $NEO4J_HOME/data/databases/customers/schema/index
目录中执行 du -h
来获取索引目录。
pwd
/Users/stephenlevett/Documents/scripts/cluster-build-scripts-master/instance1/neo4j-enterprise-4.2.5/data/databases/customers/schema/index/native-btree-1.0
ll
total 0
0 drwxr-xr-x 3 stephenlevett staff 96B 2 Jun 10:45 1
注意 1
与上面的 id
相匹配。
然后
du -h 1/*
96K 1/index-1
2) 或者使用 id
,您可以在 debug.log 中的数据库名称下的以下部分查找
[customers/eb86f508] schema:
[customers/eb86f508] index:
[customers/eb86f508] native-btree-1.0:
[customers/eb86f508] 1:
[customers/eb86f508] index-1: 2021-06-02T11:09:20+01:00 - 96.00KiB
[customers/eb86f508] - Total: 2021-06-02T10:45:09+01:00 - 96.00KiB
[customers/eb86f508] - Total: 2021-06-02T10:45:08+01:00 - 96.00KiB
[customers/eb86f508] - Total: 2021-06-02T10:45:08+01:00 - 96.00KiB
[customers/eb86f508] - Total: 2021-06-02T10:45:08+01:00 - 96.00KiB
此页面是否有帮助?