neo4j - NEO4J Cypher 查询速度慢
问题描述
我已经努力优化以下查询,但无法将其缩短到两分钟以下 - 这是预期的吗?有什么办法可以加快速度。我已添加索引并WITH
尽可能使用。
match (md:MarketingDetail {Status: 'Live'})
with md limit 10
match (md) -[:Has_Area]-> (a:Area)
with md, a
match (ss:SavedSearch) -[:Has_Area]->(a)
with md, ss match
(md) -[:Has_Trade] -> (st:SectorTrade) <-[:Has_Trade]- (ss)
where ((md.FreeholdTenure ='Freehold'
and ss.FreeholdTenure = 'true'
and (md.FreeholdSearchPrice >= ss.PriceFrom
or md.FreeholdSearchPrice is null)
and (md.FreeholdSearchPrice <= ss.PriceTo
or md.FreeholdSearchPrice is null))
or (md.LeaseholdTenure is not null
and ss.LeaseholdTenure = 'true'
and (md.LeaseholdSearchPrice >= ss.PriceFrom
or md.LeaseholdSearchPrice is null)
and (md.LeaseholdSearchPrice <= ss.PriceTo
or md.LeaseholdSearchPrice is null)))
return count(ss)
这是上述查询的配置文件 -
谢谢!
解决方案
根据您的说法PROFILE
,您没有 的索引:MarketingDetail(Status)
,这对于您的查询非常重要,因为第一个MATCH
.
此外,重组您的查询(可能以@DonWeldon 建议的方式)应该会有所帮助。
推荐阅读
- c# - 选择时如何从 Richtextbox 中复制一行?
- python - 检查 Selenium 是否基于 Web 元素滚动的条件?
- bootstrap-modal - 一个引导模式会影响另一个
- java - 我无法在程序的主循环中输入第二个选项
- python - list() 函数对可迭代对象有什么作用?
- docker - nginx 403 Forbidden on laravel project with docker
- mongodb - 如何通过shell脚本执行mongo命令?(我的不工作)
- python - start_request 的循环槽 CSV
- python - NameError:名称'cap'未定义
- grep - 如何显示使用 find 命令找到并提供给 grep 以匹配字符串的文件的完整路径