Overview
The LIMIT
statement restricts the maximum number of records to be retained in the working table. A non-negative integer must be specified in the LIMIT
statement.
<limit statement> ::= "LIMIT" <non-negative integer>
Example Graph

CREATE GRAPH myGraph {
NODE Paper ({title string, score uint32, author string}),
EDGE Cites ()-[{}]->()
} PARTITION BY HASH(Crc32) SHARDS [1]
INSERT (p1:Paper {_id:'P1', title:'Efficient Graph Search', score:6, author:'Alex'}),
(p2:Paper {_id:'P2', title:'Optimizing Queries', score:9, author:'Alex'}),
(p3:Paper {_id:'P3', title:'Path Patterns', score:7, author:'Zack'}),
(p1)-[:Cites]->(p2),
(p2)-[:Cites]->(p3)
Limiting Records Returned
MATCH (n:Paper)
RETURN n.title LIMIT 2
Result:
n.title |
---|
Efficient Graph Search |
Optimizing Queries |
Limiting Records Passed Forward
MATCH (n:Paper) LIMIT 1
MATCH p = (n)->()
RETURN p
Result: p

Limiting Ordered Records
MATCH (n:Paper)
ORDER BY n.title DESC
LIMIT 1
RETURN n.title
Result:
n.title |
---|
Path Patterns |