请问neo4j建了较多的模式索引会明显降低查询速度吗?
发布于 5 年前 作者 prolights 2007 次浏览 来自 问答

假设图数据库里有100种属性,对于其中的20种属性建了模式索引,查询的时候都会走模式索引。 CREATE INDEX ON : LableName(PropertyName); 请问neo4j建了较多的模式索引会明显降低查询速度吗? Thank you!

3 回复

索引的意义在于空间换时间,应该不会降低查询速度啊,查询更高效才对。3.5以后的版本,全文索引已经作为内置功能,不需要单独安装apoc插件,建索引和查询索引都非常方便高效可以试试。对你这个检索需求应该有很大的帮助。

// 为节点创建索引
// CALL db.index.fulltext.createNodeIndex('testMillTest',["测试标签"],["startMill"])
@Procedure( name = "db.index.fulltext.createNodeIndex", mode = SCHEMA )
public void createNodeFulltextIndex(
@Name( "indexName" ) String name,
@Name( "labels" ) List<String> labels,
@Name( "propertyNames" ) List<String> properties,
@Name( value = "config", defaultValue = "" ) Map<String,String> indexConfigurationMap )
// 检索全文索引
// CALL db.index.fulltext.queryNodes("testMillTest", "luceneQuery”) YIELD node, score RETURN node,score limit 10
@Description( "Query the given fulltext index. Returns the matching nodes and their lucene query score, ordered by score." )
@Procedure( name = "db.index.fulltext.queryNodes", mode = READ )
**public Stream<NodeOutput> queryFulltextForNodes( @Name( "indexName" ) String name, @Name( "queryString" ) String query )

@crazyyanchao “索引的意义在于空间换时间,应该不会降低查询速度啊,查询更高效才对。”原来是这样👍。 “3.5以后的版本,全文索引已经作为内置功能”,暂时没有采购企业版neo4j3.5的预算O(∩_∩)O,而且apoc很不好用常常建索引的时候run error。

@prolights 3.5社区版也是升级了这个功能,可以试一下,比APOC好用。

回到顶部