1
---
2
name: spanner-graph-query-tuning
3
metadata:
4
version: "1.0.0"
5
category: Databases
6
description: >-
7
Tunes and troubleshoots Spanner Graph on Google Cloud ISO GQL queries and
8
execution plans. Use when optimizing slow Spanner Graph GQL queries,
9
diagnosing distributed cross apply versus hash join execution operators and
10
index seek prefixes, eliminating multi-arm star query Cartesian products with
11
chained query aggregation, bounding super-node fan-out, decorrelating slow
12
subqueries or optional matches, optimizing deep quantified variable-length
13
paths, or applying join method, index, and path factorization query hints.
14
Don't use for relational-to-property-graph schema mapping over existing
15
relational tables (use spanner-relational-to-graph) or physical schema,
16
table, and interleaving design (use spanner-graph-schema-best-practices).
17
---
18
19
# Spanner Graph Query Tuning Best Practices
20
21
Optimizing ISO GQL queries on Spanner Graph requires aligning pattern matching
22
and path aggregation with Spanner's distributed query execution engine. Small
23
syntactic choices in `MATCH` and `NEXT` statements can mean the difference
24
between a targeted index seek (`SeekableKeySize: [N]`) and a full multi-way
25
cross apply over millions of intermediate paths.
26
27
## Usage Attribution
28
29
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you MUST
30
read and follow the instructions in
31
[Usage Attribution](references/attribution.md).
32
33
## Prerequisites & Cloud Environment Setup
34
35
Before profiling or executing queries against a Spanner instance (see
36
`spanner-basics` for general Spanner instance provisioning and MCP setup):
37
38
1. **Google Cloud SDK (`gcloud`) & Static Analysis Fallback**: Verify whether
39
the CLI is installed (do not install `gcloud` without explicit user
40
permission; see
41
[Install the Google Cloud SDK](https://docs.cloud.google.com/sdk/docs/install-sdk.md.txt)).
42
If `gcloud` or live Spanner database access is unavailable, do not block on
43
executing `gcloud spanner databases ddl describe` or
44
`--query-mode=PROFILE`—instead, perform static GQL query analysis and
45
rewrites directly using the user-provided query, DDL, or execution plan and
46
the bundled `references/` guides.
47
2. **Project, Billing & API**: Verify an active Google Cloud project with
48
billing enabled (required even when provisioning a free trial instance) is
49
configured (`gcloud config set project {project_id}`) and, after the user
50
confirms, enable the Spanner API
51
(`gcloud services enable spanner.googleapis.com`). Ask the user before
52
changing the active project, billing, or enabled APIs, because these commands
53
change the user's Google Cloud environment and can incur costs.
54
3. **Authentication & Identity and Access Management (IAM) Roles**: Authenticate
55
via `gcloud auth login` or `gcloud auth application-default login` (or
56
`GOOGLE_APPLICATION_CREDENTIALS` for service accounts). Inspecting DDL and
57
profiling queries requires `roles/spanner.databaseReader` (or
58
`roles/spanner.databaseUser`) on `{database_id}`.
59
4. **Instance Region, Pricing & Teardown**: For test instances, default to
60
`regional-us-central1` unless specified otherwise (see
61
[Spanner instance configurations](https://docs.cloud.google.com/spanner/docs/instance-configurations.md.txt),
62
[Google Cloud locations](https://cloud.google.com/about/locations),
63
[Spanner pricing](https://cloud.google.com/spanner/pricing), and
64
[Google Cloud pricing](https://cloud.google.com/pricing)). After benchmarking
65
on temporary test resources, remind the user to delete temporary test
66
databases
67
(`gcloud spanner databases delete {database_id} --instance={instance_id}`) or
68
test instances (`gcloud spanner instances delete {instance_id}`) so they do
69
not incur ongoing Spanner compute and storage charges.
70
71
---
72
73
## Closed-Loop Query Profiling Workflow
74
75
Never apply join or index hints blindly. Always inspect the database DDL,
76
profile the baseline query, apply structural GQL rewrites first, validate
77
compilation with `PLAN`, and re-profile to verify latency and scanned rows:
78
79
1. **Fetch the schema DDL and profile the baseline query** using
80
`gcloud spanner databases ddl describe` and
81
`gcloud spanner databases execute-sql` with `--query-mode=PROFILE` (or
82
`--query-mode=PLAN` if the baseline times out):
83
84
```bash
85
gcloud spanner databases ddl describe {database_id} --instance={instance_id}
86
87
gcloud spanner databases execute-sql {database_id} \
88
--instance={instance_id} \
89
--query-mode=PROFILE \
90
--sql="GRAPH MyGraph MATCH ... RETURN ..."
91
```
92
93
2. **Inspect key execution plan metrics** (detailed in
94
[references/profile-and-hints-guide.md](references/profile-and-hints-guide.md)):
95
- **Join Type**: Check whether traversal steps use `Distributed Cross Apply`
96
(nested-loop index seeks per input row) or `Hash Join` (set-based scan +
97
build/probe).
98
- **`SeekableKeySize` vs. `Residual Condition`**: In each `TableScan` or
99
`IndexScan`, check whether predicates are pushed down into
100
`SeekableKeySize: [N]` (index key seek) or evaluated after scanning as a
101
`Residual Condition`.
102
- **Row Amplification (`Rows Returned` vs. `Storage Read`)**: Identify which
103
`MATCH` hop causes combinatorial path explosion before a downstream filter
104
or `GROUP BY`.
105
3. **Apply structural GQL rewrites first** (see
106
[Core ISO GQL Query Rewrite Rules](#core-iso-gql-query-rewrite-rules) and
107
[references/gql-rewrite-patterns.md](references/gql-rewrite-patterns.md)) and
108
validate syntax/compilation quickly with `--query-mode=PLAN`.
109
4. **Apply statement or element hints only if the optimizer chooses a suboptimal
110
physical plan** (see
111
[Hint Selection and Guardrails](#hint-selection-and-guardrails)), and re-run
112
`--query-mode=PROFILE` to confirm improvement. If a hint degrades latency,
113
revert it immediately.
114
115
---
116
117
## Core ISO GQL Query Rewrite Rules
118
119
Before adding optimizer hints, restructure the GQL query so the cardinality
120
stays small at every step:
121
122
### Rule 1: Start Traversals from the Lowest-Cardinality Anchor Node
123
124
Order your `MATCH` patterns so the most selective filter (such as
125
`WHERE n.id = @id` or a selective indexed property) appears **first** in the
126
pattern chain:
127
128
- **Prefer:**
129
130
```sql
131
GRAPH FinGraph
132
MATCH (p:Person {id: @person_id})-[o:Owns]->(a:Account)-[t:Transfers]->(b:Account)
133
RETURN a.id AS account_id, b.id AS to_account_id, t.amount
134
```
135
136
- **Avoid:** Placing unselective patterns first or writing disconnected
137
comma-separated patterns, which can delay selectivity application:
138
139
```sql
140
GRAPH FinGraph
141
MATCH (a:Account)-[t:Transfers]->(b:Account),
142
(p:Person {id: @person_id})-[o:Owns]->(a:Account)
143
RETURN a.id AS account_id, b.id AS to_account_id, t.amount
144
```
145
146
### Rule 2: Eliminate Multi-Arm Star Query Cartesian Explosions (3 Patterns)
147
148
When a query traverses multiple independent 1:N arms from a hub node (for
149
example, fetching a consumer's emails, phones, addresses, and accounts, or a
150
router's interfaces and alarms) in a single comma-separated `MATCH`, Spanner
151
produces an $M \times N \times K$ **Cartesian product** (or sequential
152
`DistributedOuterApply` joins with `OPTIONAL MATCH`). Choose one of three
153
remedies based on the required output shape:
154
155
1. **Chained `NEXT` + Early Aggregation or Nested `ARRAY { MATCH ... }`
156
Subqueries**: Collapse each arm to 1 row per anchor node via `GROUP BY`
157
across `NEXT` stages, or collect each 1:N arm into an array column.
158
Subqueries cannot redeclare an outer graph variable, so bind a new variable
159
and compare it to the outer one
160
(`ARRAY { MATCH (n2)-[:HasEmail]->(e:Email) WHERE n2 = n RETURN e.addr }`).
161
2. **Factorized Execution Hint (`@{factorized_mode=factorize_both}`)**: When
162
flat cross-product output rows are genuinely needed, attach
163
`@{factorized_mode=factorize_both}` to the conditionally independent arms
164
(`MATCH (a)-[e1]->(a1), @{factorized_mode=factorize_both}(a)-[e2]->(a2)`) so
165
Spanner evaluates each branch once ($M + N + K$) before forming the final
166
result. Return per-arm columns; with `RETURN COUNT(*)` Spanner rejects the
167
hint (`A join in the query cannot be executed in factorized execution mode`).
168
Because the final output still materializes the cross product, the hint
169
usually gains little, while remedy 1 is much faster for aggregated results;
170
prefer remedy 1 and keep the hint only if `PROFILE` shows a gain.
171
3. **Client-Side Parallel Query Decomposition**: When returning wide property
172
lists across 4+ independent entity types for a cluster of anchor nodes,
173
execute Query 1 to fetch the anchor/cluster node IDs, then issue concurrent
174
1-hop queries (`WHERE n.id IN UNNEST(@anchor_ids)`) for each attribute branch
175
in parallel.
176
177
### Rule 3: Always Specify Node and Edge Labels Across Every `MATCH` and `NEXT` Block
178
179
In schemas with multiple node or edge tables (polymorphic labels), omitting a
180
label (`MATCH (a)-[e]->(b)`) forces Spanner to generate a `Distributed Union`
181
across **all** node and edge tables in the property graph.
182
183
- **Even more critical across `NEXT`**: When passing a node variable `n` into a
184
subsequent `NEXT MATCH (n)-[e:EdgeLabel]->(m:TargetLabel)` stage, **re-specify
185
the label on the bound node variable**
186
(`MATCH (n:SourceLabel)-[e:EdgeLabel]->(m:TargetLabel)`). Omitting
187
`:SourceLabel` on `n` in the second `MATCH` can cause Spanner to scan
188
unrelated node tables that share the same edge label.
189
190
### Rule 4: Avoid Redundant `NEXT` Self-Joins When Edge Endpoints Are Already Available
191
192
When a 1:1 or N:1 relationship has been folded into a node table
193
(`Table AS Edge`), or when you only need the destination key that is already
194
stored on the source node or edge row, do not chain an extra `NEXT MATCH` hop
195
that re-scans the same table by primary key just to project a key column or
196
check existence. Project the property directly in the initial `MATCH` stage.
197
198
### Rule 5: Bound Super-Node Fan-Out with `IS_FIRST` or Hub Exclusion, and Avoid Unbounded `OPTIONAL MATCH + LIMIT`
199
200
High-degree "super-nodes" (hub nodes with tens of thousands of incident edges)
201
can dominate query latency when a multi-hop traversal expands every neighbor.
202
203
- **Per-hop edge sampling inside quantified paths**: Use
204
`FILTER IS_FIRST(@max_edges) OVER (PARTITION BY ...)` with
205
`SOURCE_NODE_ID(selected_e)` inside an edge subquery:
206
207
```sql
208
GRAPH FinGraph
209
MATCH (a1:Account {is_blocked: true})
210
-[e:Transfers WHERE e IN {
211
MATCH -[selected_e:Transfers]->
212
FILTER IS_FIRST(@max_edges) OVER (
213
PARTITION BY SOURCE_NODE_ID(selected_e)
214
ORDER BY selected_e.create_time DESC)
215
RETURN selected_e
216
}]->{1,5}(a2:Account)
217
RETURN a1.id AS src_id, a2.id AS dst_id
218
```
219
220
- **Single-hop or midpoint sampling**: Use
221
`FILTER IS_FIRST(@k) OVER (PARTITION BY a.id)` between hops.
222
- **Deterministic hub exclusion inside quantified paths**: When hub nodes (such
223
as exchanges, payment processors, or shared system accounts) are not
224
meaningful intermediaries, precompute a boolean `is_hub` flag on the node
225
table and filter the expansion node at each step:
226
`MATCH (src:Account {id: @id})((a:Account WHERE a.is_hub = FALSE)-[e:Transfers]->(b:Account)){1,3}(dst:Account)`.
227
Both `IS_FIRST` and hub exclusion intentionally change result semantics to
228
bound fan-out: `IS_FIRST` caps per-node degree by sampling edges
229
(non-deterministic only when `ORDER BY` is omitted or has ties), whereas hub
230
exclusion drops paths through hubs while deterministically returning all
231
non-hub paths and avoiding hub neighborhood expansion at every hop. Note that
232
hub exclusion requires maintaining `is_hub` and adds a node-property lookup
233
per hop.
234
- **`OPTIONAL MATCH` + `ORDER BY` + `LIMIT` Pitfall**: Spanner cannot push
235
`LIMIT` or index sort order through the `LEFT OUTER JOIN`
236
(`DistributedOuterApply`) generated by `OPTIONAL MATCH`. Bound the optional
237
expansion inside an `IS_FIRST` or an
238
`ARRAY { MATCH (a2)-[e]->(x) WHERE a2 = a ORDER BY ... LIMIT k RETURN ... }`
239
subquery, or use `MATCH` when optionality is not required.
240
241
### Rule 6: Seek Prefix Keys Instead of Post-Filtering
242
243
Ensure `WHERE` predicates match the leading columns of the node/edge primary key
244
or secondary index so the execution plan shows `SeekableKeySize: [1]` (or `[N]`)
245
rather than `SeekableKeySize: [0]` with a `Residual Condition`. Avoid wrapping
246
key columns in non-sargable functions (such as `CAST(n.id AS STRING) = @id` or
247
`LOWER(n.code) = @code`) unless backed by a generated column index.
248
249
### Rule 7: Optimize Deep Quantified Paths (`{m, n}`) via Lightweight Recursion, Late Materialization, and `factorize_left`
250
251
1. **Do not reference intermediate node group variables inside deep quantified
252
paths**: Unreferenced intermediate node variables in
253
`((v:Node)-[e:Edge]->(t:Node)){1, 10}` are pruned automatically, **but
254
referencing `v` or `t`** (even for `ARRAY_TRANSFORM(t, n -> n.id)`, or
255
binding `MATCH p = ...` and calling `NODES(p)`) forces `RecursiveScan` to
256
scan `Node` at every hop and accumulate full `ARRAY<GRAPH_NODE>` structs
257
(with all `Node` columns) in the recursion buffer. Instead, read intermediate
258
endpoint keys from the edge group variable
259
(`ARRAY_TRANSFORM(e, el -> el.to_id)`).
260
2. **Defer wide property lookups across multi-stage queries (late
261
materialization)**: When grouping, ranking (`ORDER BY ... LIMIT`), or
262
filtering reachable nodes across `NEXT` stages on wide node tables, carry
263
only lightweight key columns (`dst.id`, satisfied from `e.to_id` via
264
foreign-key join elimination without scanning `Node`) through intermediate
265
stages, and join `(dst:Node)` in the final `NEXT` stage to fetch wide columns
266
only for surviving keys.
267
3. **Deduplicate converging paths before target node lookup
268
(`@{factorized_mode=factorize_left}`)**: When many multi-hop paths converge
269
on the same destination nodes, attach `@{factorized_mode=factorize_left}`
270
before the destination node
271
(`-[e:Transfers]->{1,3}@{factorized_mode=factorize_left}(a2:Account)`) so
272
Spanner deduplicates destination keys before probing the `Account` table.
273
Return per-path or destination columns: with `RETURN COUNT(*)` Spanner
274
rejects the hint
275
(`A join in the query cannot be executed in factorized execution mode`). The
276
payoff grows with the convergence ratio (at moderate convergence it mainly
277
reduces destination lookups and rows scanned, with little change in latency),
278
so confirm the gain with `PROFILE`.
279
280
### Rule 8: Avoid `ARRAY_AGG` with `IN UNNEST` and Correlated `EXISTS` Subquery Anti-Patterns
281
282
1. **Never pass node sets across `NEXT` via `ARRAY_AGG(n.id)` +
283
`WHERE n.id IN UNNEST(ids)`**: Aggregating IDs into an array and unnesting
284
them in the next stage forces a full table scan with per-row `ArrayUnnest`.
285
Pass the bound node variable directly
286
(`RETURN DISTINCT n NEXT MATCH (n:Label)...`).
287
2. **Decorrelate `EXISTS { MATCH ... }` subqueries via `OPTIONAL MATCH`**:
288
Correlated `EXISTS` / `NOT EXISTS` subqueries inside `WHERE` (especially
289
inside `OR` disjunctions or after `OPTIONAL MATCH`) often execute row-by-row
290
via `CrossApply`. Note that a subquery cannot redeclare an outer graph
291
variable (`NOT EXISTS { MATCH (a)-[:Transfers]->(b) }` fails with
292
`redefining graph element variables in a subquery is not allowed`), and the
293
accepted form `NOT EXISTS { MATCH (a2)-[:Transfers]->(b) WHERE a2 = a }` runs
294
as an unpushed correlated `Anti-Semi Apply` that re-scans its node table for
295
every outer row. Rewrite `NOT EXISTS` directly into
296
`OPTIONAL MATCH (a)-[:Transfers]->(b) FILTER b IS NULL` (no `NEXT` needed
297
unless following an aggregation like `GROUP BY`), which compiles into a
298
set-based hash anti-semi join. For positive `EXISTS`, use `MATCH` and
299
deduplicate with `FILTER IS_FIRST(1) OVER (PARTITION BY ...)` or `DISTINCT`
300
if multiple edges can match per outer row.
301
302
---
303
304
## GQL Semantic & Syntax Guardrails
305
306
All GQL query rewrites must preserve these syntax and semantic invariants:
307
308
- **`WHERE` vs. `FILTER` with `OPTIONAL MATCH`**: Place predicates on optional
309
pattern variables inside `OPTIONAL MATCH ... WHERE ...` (evaluated during the
310
outer join). Placing them in a trailing `FILTER` clause filters the post-join
311
table and silently turns the outer join into an inner join.
312
- **`ORDER BY` Placement**: In GQL, `ORDER BY` is ignored unless it is the final
313
clause of the query (`RETURN ... ORDER BY score DESC LIMIT 10`) or is
314
immediately followed by `LIMIT` (`ORDER BY score DESC LIMIT 10 RETURN ...`,
315
not `ORDER BY score DESC RETURN ... LIMIT 10`).
316
- **Returning Graph Elements (Final Top-Level `RETURN` Only)**: Returning raw
317
node, edge, or path variables (`RETURN n`) fails with
318
`Returning expressions of type GRAPH_ELEMENT is not allowed` **only** when
319
`RETURN` is the final statement of the top-level GQL query, because Spanner
320
cannot return `GRAPH_ELEMENT` columns directly to the client. Intermediate
321
`RETURN n NEXT ...` stages, `WITH n`, and subquery `RETURN`s (such as
322
`e IN { MATCH -[selected_e:Transfers]-> ... RETURN selected_e }`) **do** allow
323
raw graph elements—pass them directly and do **not** wrap intermediate
324
variables in `TO_JSON(n)`. Project explicit properties (`RETURN n.id, n.name`)
325
or `TO_JSON(n)` only in the final top-level `RETURN`.
326
- **Unique Output Column Names (`RETURN` and `WITH`)**: Every column in a
327
`RETURN` or `WITH` statement needs a distinct name. `RETURN a.id, b.id` or
328
`WITH a.id, b.id` fails with `Ambiguous name: id`; alias duplicates
329
(`RETURN a.id AS src_id, b.id AS dst_id`).
330
- **Reserved Words as Labels**: `Order`, `Group`, and `Contains` (among other
331
GQL/SQL keywords) must be escaped in backticks when used as labels or aliases
332
(`` (o:`Order`) ``, `` -[:`Contains`]-> ``).
333
- **Carrying Values Across `NEXT`**: A column produced by a previous statement
334
can be referenced only in the outermost `WHERE` of the next `MATCH`: write
335
`MATCH (dst:Part) WHERE dst.part_id = target_part_id`, not
336
`MATCH (dst:Part {part_id: target_part_id})`.
337
338
---
339
340
## Hint Selection and Guardrails
341
342
Use hints only after verifying with `--query-mode=PROFILE` that the default
343
optimizer plan is suboptimal. Full syntax and operator diagnostics are in
344
[references/profile-and-hints-guide.md](references/profile-and-hints-guide.md).
345
346
**Hint placement (verified on Spanner)**: element hints go *first* inside the
347
node or edge pattern (`(@{FORCE_INDEX=Idx} n:Label {...})`,
348
`-[@{FORCE_INDEX=Idx} e:Label]->`); `JOIN_METHOD` is a traversal hint placed
349
*between* elements (`-[e:Label]-> @{JOIN_METHOD=HASH_JOIN} (m:Label)`) or at
350
statement level before `GRAPH`. Writing a hint after the label
351
(`-[e:Label @{...}]->`) is a syntax error.
352
353
| Workload Pattern | Recommended Hint Strategy | Why |
354
| :--- | :--- | :--- |
355
| **Selective Anchor Traversal** (1 or a few starting nodes, 1–3 hops) | Default optimizer plan (`Distributed Cross Apply`), or element hint `(@{FORCE_INDEX=IdxName} n:Label ...)` if the wrong index is chosen | `Apply Join` performs targeted B-tree point seeks (`SeekableKeySize >= 1`) proportional only to the anchor fan-out. |
356
| **Unselective / Bulk Graph Traversal** (scanning a large fraction of nodes/edges across the graph) | Statement hint `@{JOIN_METHOD=HASH_JOIN}` before `GRAPH`, or traversal hint `-[e:Label]-> @{JOIN_METHOD=HASH_JOIN} (m:Label)`, only if `PROFILE` shows a `Distributed Cross Apply` probing millions of rows | Replaces millions of random per-row RPC index probes (`Distributed Cross Apply`) with sequential table/index scans and in-memory hash probes. The optimizer often picks a `Hash Join` for bulk scans automatically (where forcing `APPLY_JOIN` is slower). |
357
| **Selective Reverse Traversal (`<-[]-`)** | `<-[@{FORCE_INDEX=EdgeReverseIdx} e:EdgeLabel]-` (optionally with traversal hint `@{JOIN_METHOD=APPLY_JOIN}`) | Forces Spanner to seek the reverse secondary index on `(dest_id, src_id)` rather than scanning the forward edge table. |
358
| **Converging Linear / Quantified Paths** | `-[e:Edge]->{1,3}@{factorized_mode=factorize_left}(dst:Node)` (return per-path or destination columns, not `COUNT(*)`) | Deduplicates converging paths by destination key before looking up `dst` node properties. Pays off only at high convergence ratios; verify with `PROFILE`. |
359
| **Multi-Arm Star Pattern** (when flat cross-product output is needed) | `MATCH (a)-[e1]->(n1), @{factorized_mode=factorize_both}(a)-[e2]->(n2)` (return per-arm columns, not `COUNT(*)`) | Evaluates conditionally independent arms once ($M + N$) instead of via nested loops ($M \times N$). Prefer Rule 2 remedy 1 unless flat cross-product rows are required and `PROFILE` shows a gain. |
360
361
### Critical Hint Guardrails (When NOT to Use Hints)
362
363
1. **Do NOT force `@{JOIN_METHOD=HASH_JOIN}` on quantified variable-length path
364
patterns (`-[e:Edge]->{1,3}`)** or when foreign-key / schema optimizations
365
allow Spanner to eliminate intermediate node table joins. Overriding the join
366
method inside quantified paths forces full-table build/probe scans at every
367
recursion depth instead of expanding only the active frontier, which is much
368
slower on anchored `{1,3}` traversals.
369
2. **Do NOT force `@{JOIN_METHOD=HASH_JOIN}` on highly selective point lookups**
370
without an anchoring filter on the build side; a `Hash Join` without a
371
selective build-side filter may scan the entire target table.
372
3. **Always verify with `PROFILE`**: If a hint increases `Total elapsed time` or
373
`Rows scanned`, remove it immediately.
374
375
---
376
377
## Reference Guides
378
379
- **[GQL Rewrite Patterns](references/gql-rewrite-patterns.md)**: Detailed
380
before-and-after ISO GQL query transformations for anchor ordering, chained
381
`NEXT` early aggregation, label enforcement across `NEXT`, folded-edge
382
projection, `IS_FIRST` and hub-exclusion super-node bounding, `OPTIONAL MATCH`
383
subquery decorrelation, and quantified-path lightweight recursion and late
384
materialization.
385
- **[PROFILE and Hints Guide](references/profile-and-hints-guide.md)**: How to
386
read `gcloud spanner databases execute-sql --query-mode=PROFILE` output
387
(`Distributed Cross Apply`, `Hash Join`, `SeekableKeySize`,
388
`Residual Condition`) and exact syntax for statement-level, node-level, and
389
edge-level hints.
390
- **Official Spanner Graph Query Tuning Documentation**:
391
[Spanner Graph query tuning best practices](https://docs.cloud.google.com/spanner/docs/graph/best-practices-tuning-queries.md.txt)
392
393
If you need product information that's not found in these references, use the
394
`search_documents` tool of the Developer Knowledge MCP server.
395