当前位置:网站首页>Parallel one degree relation query
Parallel one degree relation query
2022-06-13 03:19:00 【Tnoy. Ma】
Parallel one degree relation query
Here’s the table of contents:
Parallel one degree relation query
Parallel query can significantly improve query performance in large data volume , Through clever use Cypher With stored procedures , Can achieve a lot of practical queries .
One 、 Query requirement
[A=[A1,A2,A3,…,An],B=[B1,B2,B3,…,Bm],A and B Is a collection of two nodes . Need to check A Each element in the and B Whether each element in the has a degree relationship , And return the related entity pairs . Parallel one degree relational query problem
Two 、 Write a basic query
This query implements the search A Each element in the and B Whether each element in the has a once related requirement , The basic function is realized . The query is executed sequentially , Can't be parallel .
The set is defined in the upper half of the query a and b, The Cartesian product is used to combine the elements of the two lists into the lower half of the query , namelyapoc.cypher.run
Part of . stayapoc.cypher.run
It realizes the query to judge whether two nodes have a one-time relationship , When there is no relation, the query will not be pushed down . stayRETURN
The start and end nodes of the partial return relationship .
WITH
['Lilly Wachowski','Carrie-Anne Moss','Laurence Fishburne'] AS a,
['Taylor Hackford','Al Pacino','Charlize Theron'] AS b
UNWIND a AS ale
UNWIND b AS ble
WITH ale,ble
CALL apoc.cypher.run(
'MATCH (a:Person)-[r]-(b:Person) WHERE a.name={ale} AND b.name={ble} RETURN r LIMIT 1',
{ale:ale,ble:ble}
)
YIELD value
WITH value.r AS r
RETURN STARTNODE(r) AS sNode,ENDNODE(r) AS eNode
3、 ... and 、 Optimize queries using parallelism
stay
Two
Based on the query , Useapoc.cypher.parallel2
Parallel mode optimization , Similarly, the parallelism of many degree relations can also be realized in this way . By default , The maximum number of parallels is CPU Number of cores x 100. for example , If the database is assigned 4 Kernel , Then the maximum number of parallel processes is 400. The performance of batch query through this statement will be at least 50% The above promotion .
CALL apoc.cypher.parallel2(
'WITH $a AS a,$b AS b UNWIND a AS ale UNWIND b AS ble WITH ale,ble CALL apoc.cypher.run( \'MATCH (a:Person)-[r]-()-[*..3]-(b:Person) WHERE a.name={ale} AND b.name={ble} RETURN r LIMIT 1\', {ale:ale,ble:ble} ) YIELD value WITH value.r AS r RETURN STARTNODE(r) AS sNode,ENDNODE(r) AS eNode ',
{a:['Lilly Wachowski','Carrie-Anne Moss','Laurence Fishburne'],b:['Taylor Hackford','Al Pacino','Charlize Theron']},
'a'
)
边栏推荐
- 最近最少使用缓存(来源力扣)
- Use of interceptors webmvcconfigurer
- Microservice practice based on rustlang
- PHP uses the header function to download files
- Least recently used cache (source force deduction)
- When the flutter runs the project, the gradle download fails, and the running gradle task 'assemblydebug' is always displayed
- Age anxiety? How to view the 35 year old programmer career crisis?
- JVM class loading (I)
- 2019 - sorting out the latest and most comprehensive IOS test questions (including framework and algorithm questions)
- Solution of Kitti data set unable to download
猜你喜欢
Querywrapper constructor method
Typical application of ACL
JVM GC (V)
Flutter reports an error type 'Int' is not a subtype of type 'string' wonderful experience
The extra money we made in those years
Summary of rust language practice
MySQL 8.0 installation free configuration method
Use and arrangement of wechat applet coordinate position interface (I)
JVM virtual machine stack (III)
Applet image component long press to identify supported codes
随机推荐
2019 - sorting out the latest and most comprehensive IOS test questions (including framework and algorithm questions)
Wechat applet switch style rewriting
Review notes of RS data communication foundation STP
. Net compact Framework2.0 wince intelligent device development project experience sharing Net drag space advanced
brew工具-“fatal: Could not resolve HEAD to a revision”错误解决
Four ways of array traversal in PHP
This article takes you to learn DDD, basic introduction
DDL operation table
How to Draw Useful Technical Architecture Diagrams
技术博客,经验分享宝典
Code d'initialisation de l'arbre binaire
Open source - campus forum and resource sharing applet
Control scanner in Delphi
Simple use of qtreeview of QT (including source code + comments)
Brew tool - "fatal: could not resolve head to a revision" error resolution
Microservice practice based on rustlang
Large attachment fragment upload and breakpoint continuation
Summary of rust language practice
【pytorch 記錄】pytorch的變量parameter、buffer。self.register_buffer()、self.register_parameter()
C method parameter: ref