What is Cypher?
Cypher · 6 min read
Cypher is the query language for property graphs. Its defining idea is that the query looks like the data: you draw the pattern you're after with ASCII art — `(a)-[:KNOWS]->(b)` — and the engine finds every subgraph that matches. CognoDB speaks Cypher over Bolt, the same one the Neo4j drivers already emit.
A pattern language
Nodes are written in parentheses, (p:Person), relationships in square brackets with a direction, -[:FOLLOWS]->. A pattern chains them together to describe a shape. MATCH (p:Person)-[:FOLLOWS]->(f:Person) reads almost literally as "a person who follows another person," and that readability is the whole point — the query is a picture of the answer.
The verbs you'll actually use
MATCH finds patterns. WHERE filters them. RETURN shapes the output. MERGE gets-or-creates a node or relationship (the idempotent write you'll lean on for loading data). And Cypher has real aggregation — count, collect, avg — so you can group and rank in the same query that traverses.
MATCH (c:Customer)-[:PLACED]->(o:Order)-[:CONTAINS]->(p:Product)
WHERE o.created_at > date('2026-01-01')
RETURN c.name, count(DISTINCT p) AS distinct_products, sum(o.total) AS spend
ORDER BY spend DESC
LIMIT 20Variable-length paths — the thing SQL can't say cleanly
The move that makes graphs worth it: match a relationship repeated an unknown number of times. [:REPORTS_TO*1..6] follows a chain one to six hops deep; shortestPath finds the tightest connection between two nodes. Reachability, ownership chains, dependency depth — one line each, where SQL needs recursive CTEs that grow with every hop.
MATCH (p:Person {id: $id})-[:REPORTS_TO*1..10]->(manager:Person)
RETURN manager.name, manager.titleFull-text search, inside the query
CognoDB maintains full-text indexes with BM25 ranking inside the database, callable from Cypher. So a keyword search returns nodes you can immediately traverse from — find the document, then walk to its author and topics in the same query, one round trip instead of a search service plus follow-up lookups.
CALL db.index.fulltext.queryNodes('docs', $q) YIELD node, score
MATCH (node)<-[:AUTHORED]-(author:Person)
RETURN node.title, author.name, score
ORDER BY score DESC
LIMIT 10It's the Cypher your drivers already speak
Cypher is an openCypher-derived language and the basis of the ISO GQL standard, so it isn't proprietary lock-in. Practically, that means the official Neo4j drivers emit Cypher over Bolt and CognoDB accepts it unchanged — if your code already runs against a Bolt-speaking graph, pointing it at a CognoDB instance is a URI change, not a rewrite.
Questions
Common questions.
Is Cypher hard to learn if I know SQL?
Most SQL users are productive in an afternoon. The concepts transfer — filtering, aggregation, ordering — and the pattern syntax is more intuitive for relationships than joins. The main new idea is variable-length paths, which have no clean SQL equivalent.
Is Cypher a standard or proprietary?
Cypher started at Neo4j, was opened as openCypher, and is the foundation of ISO GQL, the international standard graph query language. CognoDB implements Cypher over the open Bolt protocol, so you're not adopting a closed language.
Do I need to write Cypher if I use a driver?
The driver carries your Cypher to the database — you still write the queries, in the same string form you'd use against any Bolt graph. There's no separate CognoDB SDK or dialect to learn.
What Cypher features does CognoDB support?
Pattern matching, variable-length paths, shortestPath, MERGE, WHERE, aggregation, constraints and full-text BM25 search. It does not ship vector search or graph algorithms such as PageRank or community detection.
Keep reading
Concepts
What is a graph database?
A graph database stores data as nodes and relationships instead of tables and joins. Here's how the model works, why traversals beat joins for connected data, and when to use one.
ReadGraphRAG
What is GraphRAG?
GraphRAG grounds an LLM by traversing a knowledge graph instead of retrieving text chunks by similarity alone. Here's how it works, why it improves multi-hop answers, and how to build it.
ReadGuidance
When not to use a graph
Graph databases are powerful for connected data, but they're the wrong tool for several common workloads. Here's when to reach for Postgres, a columnar store, a queue or a vector index instead.
ReadStart now
~98.7%
token efficiency at 2,000 entities — see the footnotes above
Try the ideas on a real graph.
A free instance takes about a minute and no card. Every Cypher snippet on this page runs against it unchanged.
First-graph path
LiveCreate a free instance
No card. Ready in about a minute.
Connect your driver
bolt+ssc:// URI into the driver you already use.
Write two MERGEs
That's the entire shape of agent memory.
Point an agent at it
One MCP config block. No integration code.