当前位置:网站首页>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'
)
边栏推荐
- PHP uses the header function to download files
- Spark Foundation
- Operating principle of JS core EventLoop
- Available types in C #_ Unavailable type_ C double question mark_ C question mark point_ C null is not equal to
- Install MySQL database
- . Net compact Framework2.0 wince intelligent device development project experience sharing Net drag space advanced
- Reading notes of effective managers
- C# . NET ASP. Net relationships and differences
- Polymorphism in golang
- Simple use of qtreeview of QT (including source code + comments)
猜你喜欢
Scala implements workcount
Vscode liveserver use_ Liveserver startup debugging
Installing the IK word breaker
The extra money we made in those years
二叉树初始化代码
brew工具-“fatal: Could not resolve HEAD to a revision”错误解决
Data Governance Series 1: data governance framework [interpretation and analysis]
English grammar_ Mode adverb position
Available types in C #_ Unavailable type_ C double question mark_ C question mark point_ C null is not equal to
Microservice practice based on rustlang
随机推荐
Installing the IK word breaker
Install MySQL database
Vs 2022 new features_ What's new in visual studio2022
【pytorch 記錄】pytorch的變量parameter、buffer。self.register_buffer()、self.register_parameter()
2022.05.29
Summary of rust language practice
Several functions in YAF framework controller
C method parameter: ref
Open source - campus forum and resource sharing applet
MMAP usage in golang
Radium laser radar C16 data to PCD (based on ROS)
Three ways to start WPF project
Differences of several query methods in PDO
Unified scheduling and management of dataX tasks through web ETL
IOS interview · full bat interview record of an IOS programmer (including the true interview questions of Baidu + Netease + Alibaba)
C # simple understanding - method overloading and rewriting
. Net compact Framework2.0 wince intelligent device development project experience sharing Net drag space advanced
In my ten years, every bit has become a landscape?
Summary of the latest IOS interview questions in June 2020 (answers)
Using linked list to find set union