当前位置:网站首页>Neo4j--- performance optimization
Neo4j--- performance optimization
2022-06-30 03:13:00 【Sea of sperm whales】
One 、 Basic tuning
1、cql Statement performance troubleshooting
(1)EXPLAIN + Executive cql sentence
Just view the execution plan , Do not execute statements
(2)PROFILE + Executive cql sentence
Run statement , And supervise the use of resources in the whole process
(3) Check index creation
:schema
2、 Use advice
1) Create indexes for related primary keys Grammar format CREATE INDEX ON: label ( Fields to be checked );
① Schema index : Schema indexes are very similar to indexes in relational databases , Each index corresponds to a label and a set of attributes , Whether updating or deleting nodes , The index will be automatically updated or deleted , Therefore, this method of index creation is more applicable .
Be careful : Index status is ONLINE To take effect , Otherwise, the newly created index is invalid .
2) Create unique index , Avoid data warehousing checks , Cause performance waste ( You can verify the integrity and uniqueness of data before warehousing )CREATE CONSTRAINT ON (n:ResNode) ASSERT n.id IS UNIQUE;
3)create and merge The difference between MERGE The order is CREATE Command and MATCH The combination of orders . MERGE = CREATE + MATCH Therefore, new nodes should be avoided merge;
4) Unnecessary data , Filter out as early as possible , Reduce the amount of post-processing data ;
5) Avoid returning entire nodes , Return the required data .
Two 、 Optimize neo4j The configuration file
Yes neo4j.conf File and modify accordingly . By adding jvm Virtual environment can improve the query speed of database , Cancel now neo4j About... In the configuration file dbms.memory.heap.initial_size=512m;dbms.memory.heap.max_size=512m Two lines of comments , And make appropriate modifications ( The larger the maximum heap memory, the better , But less than the physical memory of the machine ).
3、 ... and 、 Advanced solutions solve performance problems
1、 Reasonably introduce middleware
eg: Involving content keyword search , have access to elasticSearch, Avoid going directly from neo4j Search for , If you can combine redis And memory cache to get detailed resource information , Search only returns the primary key , It can further improve query submission efficiency , The user experience has greatly improved ;
Involving a large number of queries, you can use redis As neo4j A cache library for , It can improve performance , Can also avoid neo4j Resource consumption ;
2、 Sub database storage , make the best of neo4j Graph storage and query features ,neo4j Only graph storage and query functions are provided in , The attribute information of the node is saved in mongodb( Or others NoSql In the database — Fields can be stored directly ) Make association query , Each in his element , Make full use of advantages , Optimize performance ;
3、 Use neo4j Enterprise high availability 、 Cluster solution .
边栏推荐
- Hands on in-depth learning notes (XV) 4.1 Multilayer perceptron
- Some technology sharing
- [QT] QMap使用详解
- The broadcast module code runs normally in autojs4.1.1, but an error is reported in pro7.0 (not resolved)
- Distributed file system fastdfs
- WPF Initialized事件在.cs中绑定不被触发的原因
- 简单自定义mvc
- 2022 underground coal mine electrical test and underground coal mine electrical simulation test
- golang bilibili直播彈幕姬
- Use of Arthas
猜你喜欢
MySQL extracts strings from table fields
Customize the buttons of jvxetable and the usage of $set under notes
Use of custom MVC
Distributed file storage system fastdfs hands on how to do it
【直播笔记0629】 并发编程二:锁
Intel hex, Motorola S-Record format detailed analysis
mysql 主从数据库同步失败的原因
uniapp 地址转换经纬度
How to use vant to realize data paging and drop-down loading
prompt learning 一个空格引发的血案
随机推荐
O & M (20) make and start USB flash disk and install win10
Mysql 带上库名称跨库操作可能出现的问题
Personal PC installation software
GTK interface programming (II): key components
Code for generating test and training sets
编译一个无导入表的DLL
Mysqldump principle
 与空格的区别
Intel hex, Motorola S-Record format detailed analysis
How to use redis to realize the like function
hudi记录
WPF initialized event in The reason why binding is not triggered in CS
个人PC安装软件
Mysql提取表字段中的字符串
[wechat applet] how did the conditional rendering list render work?
What are outer chain and inner chain?
NLP text summary: data set introduction and preprocessing [New York Times annotated corpus]
Distributed file system fastdfs
Sorting method of administrative route code letter + number
  Difference from spaces