Skip to content

Introduce prepared Cypher queries #9

@sunsided

Description

@sunsided

Summary

Add a PreparedQuery type that parses/plans a Cypher query once and executes it many times, especially with parameters.

Motivation

Repeatedly parsing the same query is unnecessary for application workloads. Prepared queries would also give users a natural home for parameterized execution.

Example API

let query = PreparedQuery::parse(
    "MATCH (p:Person) WHERE p.name = $name RETURN p",
)?;

let rows = query.execute(&graph, params)?;

Suggested approach

  • Wrap the planned CypherQuery in a public PreparedQuery type.
  • Add read execution from a prepared query.
  • Later extend to mutation if appropriate.
  • Integrate with the proposed parameter API.

Acceptance criteria

  • A query can be parsed once and executed multiple times.
  • Prepared query execution returns the same rows as graph.cypher(...) for equivalent inputs.
  • Prepared queries support parameterized execution once parameters exist.

Suggested labels: enhancement, performance, api
Suggested milestone: Generalize the API

Metadata

Metadata

Labels

kilo-duplicateAuto-generated label by Kilokilo-triagedAuto-generated label by Kilo

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions