Neo4j Certified Professional flashcards
Neo4j Certified Professional · Build recall with a focused review session.
39 cards. Read the term and the definition here. The deck at the top of this page is optional.
- MATCH clause purpose
- MATCH specifies a pattern to find in the graph and binds variables to matching nodes and relationships. It does not filter rows by itself; use WHERE or pattern properties for filtering.
- OPTIONAL MATCH semantics
- OPTIONAL MATCH behaves like a left outer join. When no pattern match exists, bound variables become null, so rows from the preceding clause are preserved instead of being dropped.
- MERGE and ON CREATE
- MERGE matches an existing pattern or creates it. ON CREATE SET runs only when the pattern was created, and ON MATCH SET runs only when it already existed.
- WITH clause role
- WITH passes results from one query part to the next. It can aggregate, order, limit, and filter with WHERE, and it drops any variables not explicitly listed.
- Variable-length relationship syntax
- The pattern -[:TYPE*1..3]-> matches paths of one to three relationships of that type. A bare asterisk means one or more hops; *0.. also permits zero hops.
- count DISTINCT aggregation
- count(DISTINCT n) counts unique values of n rather than rows. It is used to avoid double counting when a pattern produces multiple rows for the same entity.
- CALL subquery and transactions
- CALL { ... } runs a subquery, once per incoming row by default. Adding IN TRANSACTIONS OF n ROWS batches writes into separate transactions, useful for large updates.
- UNION column requirements
- UNION combines the results of two queries and removes duplicates; UNION ALL keeps duplicates. Both queries must return the same number of columns with identical names.
- Property graph model
- Neo4j stores nodes with labels and properties, plus directed, typed relationships that also carry properties. Relationships are stored as pointers, making traversal independent of total graph size.
- Relationship direction rule
- Every relationship has exactly one start node, one end node, and one type. It is stored with a single direction but can be matched and traversed in either direction in Cypher.
- EXPLAIN versus PROFILE
- EXPLAIN returns the execution plan without running the query. PROFILE runs the query and reports actual rows and db hits per operator, revealing real bottlenecks.
- Neo4j transaction locking
- Writes acquire locks on nodes and relationships they modify. Neo4j detects deadlocks and rolls back one transaction, which the driver may retry as a transient error.
- Causal cluster roles
- A cluster has a leader that accepts writes, followers that replicate and serve reads, and read replicas that scale reads. Routing drivers send writes to the leader automatically.
- Multiple labels per node
- A node can have zero or more labels. Labels are used for lookup and constraints, so filtering by label in MATCH allows the planner to start from a label index.
- Uniqueness constraint syntax
- CREATE CONSTRAINT name FOR (n:Label) REQUIRE n.prop IS UNIQUE creates a uniqueness constraint and a backing index that also speeds up lookups on that property.
- Existence constraint availability
- The IS NOT NULL property existence constraint is available in Neo4j Enterprise Edition. Community Edition supports uniqueness constraints but not existence or node key constraints.
- Composite index behavior
- CREATE INDEX name FOR (n:Label) ON (n.a, n.b) builds a composite index. It serves queries filtering on the leading property a, or on both a and b, but not on b alone.
- Full-text index usage
- A full-text index is created with CREATE FULLTEXT INDEX and queried with db.index.fulltext.queryNodes, supporting tokenized, fuzzy, and relevance-ranked text search rather than exact equality.
- Index usage blockers
- A range index is used only when the query filters on the indexed label and property directly. Applying a function such as toLower to the property prevents index usage.
- SHOW INDEXES command
- SHOW INDEXES lists schema indexes with name, type, labels, properties, and state. SHOW CONSTRAINTS lists constraints. Both help verify that the planner has usable schema objects.
- Node key constraint
- REQUIRE (n.a, n.b) IS NODE KEY, available in Enterprise Edition, enforces that the property combination is unique and that every listed property exists on the node.
- Driver URI schemes
- The neo4j:// scheme creates a routing driver for a cluster and directs writes to the leader. The bolt:// scheme connects directly to one server without routing.
- Driver and session lifetime
- The driver is long-lived, thread-safe, and holds the connection pool. Sessions are short-lived and single-threaded. Transactions or transaction functions wrap each unit of work.
- Parameterized query benefit
- Parameters such as $name send values separately from query text, preventing Cypher injection and allowing the server to reuse cached execution plans across calls.
- Transaction function retries
- executeRead and executeWrite in Java, and execute_read and execute_write in Python, retry the unit of work automatically when a transient error such as a deadlock occurs.
- Bookmarks and read-your-writes
- A bookmark records the transaction a session has completed. Passing it to a later session ensures that session sees the earlier write, providing causal consistency across sessions.
- Relationship versus node choice
- Use a relationship when a concept only connects two entities and needs no further connections. Promote it to a node when it must link to more than two entities or be shared.
- Hyperedge intermediate node
- An intermediate node models a relationship that connects more than two entities. For example, a Rating node links a user and a movie and can hold the score property.
- Supernode mitigation
- A supernode has a very large number of relationships, slowing traversal. Mitigate by introducing intermediate nodes or by filtering on specific relationship types in the pattern.
- Denormalization for read speed
- Storing precomputed aggregates as node properties trades write-time maintenance for faster reads. It is appropriate when recomputing the aggregate by traversal is too expensive.
- LOAD CSV import directory
- LOAD CSV reads files from the database import directory when given a file:/// URL. The path is relative to the configured import directory, not the client machine.
- Batched LOAD CSV writes
- Wrapping LOAD CSV in CALL { ... } IN TRANSACTIONS OF 10000 ROWS splits a large import into multiple transactions, avoiding one oversized transaction and excessive memory use.
- neo4j-admin bulk import
- neo4j-admin database import full loads CSV files into a new or empty database while it is stopped. It is much faster than LOAD CSV for initial bulk loads.
- Import CSV header fields
- Bulk import headers declare :ID for unique node identifiers, :LABEL for node labels, :START_ID and :END_ID for relationship endpoints, and :TYPE for the relationship type.
- Empty CSV field handling
- An empty CSV field loads as an empty string, not null. Use a CASE expression to convert empty strings to null when property absence matters for constraints or queries.
- shortestPath function
- shortestPath((a)-[*]-(b)) returns one shortest path between two nodes. Use allShortestPaths to return every path tied for the minimum length.
- DETACH DELETE behavior
- DETACH DELETE removes a node together with all its relationships. Plain DELETE fails when the node still has relationships, protecting against accidental orphaned data.
- Finding duplicate property values
- MATCH (n:L) WITH n.prop AS p, count(*) AS c WHERE c > 1 RETURN p finds duplicates. Remove them before adding a uniqueness constraint, which would otherwise fail.
- AllNodesScan plan operator
- AllNodesScan means the planner scans every node because no label or index was usable. Adding a label and an indexed property filter typically replaces it with a targeted lookup.