apoc.cypher.runManyReadOnly

This procedure is not considered safe to run from multiple threads. It is therefore not supported by the parallel runtime. For more information, see the Cypher Manual → Parallel runtime.

Details

Syntax

apoc.cypher.runManyReadOnly(statement, params [, config ]) :: (row, result)

Description

Runs each semicolon separated read-only statement and returns a summary of the statement outcomes.

Input arguments

Name

Type

Description

statement

STRING

The Cypher statements to run, semicolon separated (;).

params

MAP

The parameters for the given Cypher statements.

config

MAP

{ statistics = true :: BOOLEAN }. The default is: {}.

Return arguments

Name

Type

Description

row

INTEGER

The row number of the run Cypher statement.

result

MAP

The result returned from the Cypher statement.

Example

Given this dataset:

CREATE (:Person {name: 'Alice', age: 30}),
     (:Person {name: 'Bob', age: 25}),
     (:Person {name: 'Charlie', age: 35})

The following query runs two semicolon-separated read-only statements in a single call. Row numbers reset independently for each statement:

CALL apoc.cypher.runManyReadOnly(
  'MATCH (p:Person) WHERE p.age < 30 RETURN p.name AS name;
   MATCH (p:Person) WHERE p.age >= 30 RETURN p.name AS name ORDER BY p.name;',
  {},
  {statistics: false}
)
YIELD row, result
Results
row result

0

{name: "Bob"}

0

{name: "Alice"}

1

{name: "Charlie"}

The row counter resets to 0 at the start of each statement. By default (statistics: true), each statement also appends a summary row with row: -1 containing query statistics such as nodesCreated and propertiesSet. This is disabled in the example above via statistics: false. Any write operations passed to apoc.cypher.runManyReadOnly are silently skipped - use apoc.cypher.runMany if write operations are required.