MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cypher_cond_selectivity

Function cypher_cond_selectivity

src/cypher/cypher.c:5873–5881  ·  view source on GitHub ↗

── Planner: seed a single-hop pattern from its selective end ────────────── * * The executor scans pattern node 0 and expands from there. Written as * `MATCH (a)-[:CALLS]->(b) WHERE b.name = '_printk'`, that scans every node * in the store before the filter on `b` can discard any — on an 8.5 M node * kernel graph the query hit the execution-time limit while the anchored * spelling `MATCH (b:

Source from the content-addressed store, hash-verified

5871 * one single-relationship pattern with an explicit RETURN, and never to an
5872 * OPTIONAL MATCH, whose anchor is part of its meaning. */
5873static int cypher_cond_selectivity(const cbm_condition_t *c, const char *var) {
5874 if (!c || !c->variable || !var || strcmp(c->variable, var) != 0 || c->negated) {
5875 return 0;
5876 }
5877 if (!c->op || strcmp(c->op, "=") != 0 || !c->property) {
5878 return 0;
5879 }
5880 return (strcmp(c->property, "name") == 0 || strcmp(c->property, "qualified_name") == 0) ? 3 : 2;
5881}
5882
5883/* Best equality on `var` reachable through AND alone. An AND chain is linked
5884 * along the right child (expr_chain_link), so the links are walked in a loop

Callers 2

cypher_expr_selectivityFunction · 0.85
cypher_node_selectivityFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected