Graph name, Query, [timeout], [--compact], [version]
Returns: Result set
Queries and Parameterized Queries
The execution plans of queries, both regular and parameterized, are cached (up to CACHE_SIZE unique queries are cached). Therefore, it is recommended to use parameterized queries when executing many queries with the same pattern but different constants. Query-level timeouts can be set as described in the configuration section.Command structure
GRAPH.QUERY graph_name "query" [timeout value] [--compact] [version value]
example:
Parameterized query structure:
GRAPH.QUERY graph_name "CYPHER param=val [param=val ...] query"
example:
Query language
The syntax is based on Cypher. Most of the language is supported. See Cypher documentation.Frequently Asked Questions
Why should I use parameterized queries instead of string interpolation?
Why should I use parameterized queries instead of string interpolation?
Parameterized queries allow FalkorDB to cache and reuse execution plans across queries that differ only in their constant values. This significantly improves performance. They also prevent Cypher injection attacks.
What happens when a query exceeds the timeout?
What happens when a query exceeds the timeout?
When a query exceeds the configured timeout (in milliseconds), it is terminated and an error is returned to the client. You can set timeouts per-query using the
TIMEOUT argument, or globally via GRAPH.CONFIG SET TIMEOUT_DEFAULT and TIMEOUT_MAX.What does the --compact flag do?
What does the --compact flag do?
The
--compact flag returns results in a compact format that uses internal IDs instead of string labels and property names. This reduces network bandwidth and is intended for use by client libraries that maintain their own schema cache.What is the version parameter used for?
What is the version parameter used for?
The
version parameter enables optimistic schema caching. When a client provides a version number that does not match the current graph version, the server returns a version mismatch error, signaling the client to refresh its cached schema mappings.Are execution plans cached automatically?
Are execution plans cached automatically?
Yes. FalkorDB caches execution plans for up to
CACHE_SIZE unique queries (configurable). Both regular and parameterized queries benefit from plan caching.