Cypher query limit results and delete

x13

I am trying to remove 20000 nodes which have datestamp property = 20130808 but when I replace "DELETE nx" with "RETURN COUNT(nx)" the result is 7880 and not 20000, at this moment I have 1000000 nodes in Neo4j 1.9.2. How can I make that correctly?

Cypher query:

START nx=node(*)
WITH nx
LIMIT 20000
WHERE HAS (nx.datestamp) AND nx.datestamp = 20130808 AND ID(nx) <> 0
DELETE nx
Stefan Armbruster

Thats because you first choose 20k arbitrary nodes and then apply the WHERE filter. You have to do it the other way round:

START nx=node(*)
WHERE HAS (nx.datestamp) AND nx.datestamp = 20130808 AND ID(nx) <> 0
WITH nx
LIMIT 20000
DELETE nx

Be aware that this kind of global operation with property access is expensive. A better approach would be to enable autoindexing for datestamp and then do:

START n=node:node_auto_index(datestamp=20130808)
WITH n
LIMIT 20000
DELETE n

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Is there a way to limit query results by values in an IN list?

分類Dev

How can I limit the number of results of a specific part of an SQL query?

分類Dev

How do I limit the number of results from context.Query in DynamoDB in .NET

分類Dev

EXISTS cypher query with dynamic labels

分類Dev

MySQL Delete with Limit

分類Dev

Collecting results with optional nodes in Neo4j cypher results

分類Dev

Delete the ":" character from results

分類Dev

Android SearchRecentSuggestionsProvider query limit

分類Dev

Over Query limit

分類Dev

LIMIT not working on complex query

分類Dev

Cypher query can't find node by label

分類Dev

Efficient Cypher Update Query to Capture "Discovered" Relationships

分類Dev

Error while forcing index in cypher query

分類Dev

Cypher Query to Return Nodes in Path Order

分類Dev

Can't use EXISTS in a cypher query

分類Dev

Access query based on query results

分類Dev

No results from SQL Query

分類Dev

No results from SQL Query

分類Dev

No results matched the query

分類Dev

ORDER BY results of a query (nested?)

分類Dev

Parse "or" query with limit returns all records ignoring limit on single query

分類Dev

Limit amount of parameters in query string

分類Dev

Ruby on Rails query limit in a range

分類Dev

Limit the results of a Swift array filter to X for performance

分類Dev

DELETE query onclick automized

分類Dev

Using the results of one query as a subarray in the results of another

分類Dev

Remote delete inconsistently hits resource limit / timeout

分類Dev

Cypher query don't return relations when finding multiple records

分類Dev

Cypher query for assigning property values in an arbitrary number of nodes

Related 関連記事

ホットタグ

アーカイブ