Skip to main content
Query performance directly impacts your application’s scalability. Debug notices help you understand how your queries run internally and identify opportunities for optimization. See the Performance considerations article for core principles and best practices for optimizing queries. Use debug notices to see details about filtering efficiency, index usage, sorting behavior, and execution plans.
Debug notices highlight common performance patterns but don’t detect all inefficiencies.
For full details on debug notices, open POST /models/instances/query and POST /models/instances/sync from the Instances group of the API reference. The request debug object sets configuration options, and the response debug object lists the notices.

Enable debug notices

To enable debug notices in your queries:
1

Add debug configuration to your request

Add a debug object to your API request to activate debug notices:
2

Adjust timeout if needed

If your query times out, increase the timeout value and disable query results output:
The maximum timeout is 55,000 milliseconds (55 seconds). Specify timeout values in milliseconds.

Understand grades and profiling

Debug notices highlight both positive and negative aspects of your query execution. They warn about potential performance issues and confirm when your query is well optimized.

Grades

Each debug notice includes a grade that shows the importance or impact of the notice. Use this grading system to prioritize issues and recognize good practices:
The grading is conservative by default. Enable detailed profiling by setting profile: true to see the full spectrum, including critical warnings (E) and strong positive confirmations (A). Profiling provides deeper insights for more accurate grading.

Enable profiling

The profile option enables detailed query profiling, which gathers runtime statistics like execution timing and resource usage for each query part. Profiling focuses on internal diagnostics, and you must disable query results by setting emitResults to false. Use this analysis for complex queries to uncover hidden performance bottlenecks. To activate profiling:
1

Configure debug with profiling enabled

Activate profiling with this basic example:

Request execution plans

Alpha: The includePlan feature is in alpha. The format of the execution plan in the response is not guaranteed to be stable and may change in future versions. Do not build production systems that rely on the specific structure of this output.
Request the underlying PostgreSQL execution plan as part of debug notices by enabling the appropriate debug options. The execution plans show how the query processes at the database level. Execution plans help you analyze and diagnose query performance issues. If you have advanced PostgreSQL knowledge, you can also use these plans to understand query execution strategy and identify optimizations. To include execution plans:
1

Enable includePlan in debug configuration

Include execution plans with this minimal example:

Request translated queries

Alpha: The translatedQuery feature is in alpha. The format of the translated query in the response is not guaranteed to be stable and may change in future versions. Do not build production systems that rely on the specific structure of this output.
Request the underlying query representation by enabling the translatedQuery debug option. This feature is intended for advanced debugging. To include the translated query:
1

Enable translatedQuery in debug configuration

Include the translated query with this minimal example:

Handle common debug notices

This section focuses on specific debug notices the API returns and how to resolve them.

Quick reference

sortNotBackedByIndex

Problem: Your query uses a sort order without a cursorable index. The system performs an in-memory sort at query time, which increases resource usage and slows performance as data scales. Solution: Ensure your data model includes a cursorable index that matches your query’s sort order. This matters especially when sorting by multiple properties. Your query’s sort order must exactly match the property order in the index for the database to use it efficiently. To resolve this issue:
1

Identify the sort order in your query

If your query contains this sort:
Ensure that "container" has a compound index on properties A,B in that order. The order matters, and an index on B,A won’t work.
2

Create the matching cursorable index

Create the index using NEAT, Schema Service, or the DMS API. To create the index using the DMS API, send this request to models/containers:
Replace index-identifier with an appropriate identifier for your index.

suggestedCursorableSort

Problem: Your filter and sort don’t exactly match a cursorable index, but an existing cursorable index can serve the query if you use a slightly different sort. Without that sort, the query engine can’t paginate by reading one contiguous range of the index. Solution: Use the suggestedSort from the notice as the full sort of the result expression. Among the rows your filter returns, the suggested sort keeps the order of your original sort. It prepends properties that your equality filters already fix to one value, and appends properties that only break ties. If your query has no sort, the notice proposes one, and the notice has no originalSort. To resolve this issue:
1

Read the suggested sort from the notice

Suppose container Pump has a cursorable index statusName on properties status, name, and serialNumber. Your query filters on status with equals and sorts by name. The notice suggests a sort that matches the index. These are the relevant fields of the notice:
2

Use the suggested sort in your query

Replace the sort of the result expression with suggestedSort. Keep all properties, their order, directions, and nullsFirst values. Removing or reordering a property can make the sort non-cursorable again.The properties in suggestedSort reference containers. If your query uses views, replace each property reference with the matching view property, for example ["space", "PumpView/v1", "name"].

unindexedThrough

Problem: Your query uses a through clause to traverse a direct relation. This notice appears when the traversal direction requires a missing index. Traversing a direct relation inwards requires an index on the relation’s target. Without it, the query scans many nodes to find the ones pointing to the source, which is inefficient and won’t scale. Solution: Define an index on the property that is the target of the inwards direct relation. To resolve this issue:
1

Identify the inwards relation in your query

If your query looks like this:
Because the direction is “inwards”, the query engine needs to efficiently look up nodes in “containerB” that have a direct relation named “directRelationB” pointing to the nodes from step “0”.
2

Create an index on the relation property

Create an index on the “directRelationB” property within “containerB” as shown in the sortNotBackedByIndex section.

filterIncompatibleWithCursorableIndexScan

Problem: A cursor-paginated result expression has a filter that can’t be served by one contiguous scan of a cursorable index. Instead of resuming from the cursor position in the index, the query engine may have to scan and discard rows again for every page. Solution: Rewrite the filter so that it fits a single cursorable index scan, without changing what the query returns. A compatible filter:
  • Combines conditions with and only.
  • Uses properties from a single container. A filter on space alongside that container is fine.
  • Has any number of equals and in conditions.
  • Has range, prefix, or exists conditions on at most one property.
The reasons field of the notice lists what makes the filter incompatible: This notice only checks the shape of the filter. A cursorable index whose leading properties are the equals and in properties, followed by the range property and the sort properties, must also exist. See sortNotBackedByIndex to create one.

significantPostFiltering

Problem: The query engine processed many intermediate rows before filtering them to the final result set. This is inefficient because significant work goes to data that gets discarded. This happens when filters aren’t selective enough in early stages of a chained query. Solution: Review your query to introduce more selective filters earlier. Use your knowledge about the data graph to narrow intermediate results as much as possible. To resolve this issue:
1

Review your query for late filtering

Consider this query that fetches all pumps in space “SiteA” with an edge from another pump:
Steps 0 and 1 could fetch many pumps and connecting edges from all sites before step 2 filters them to just “SiteA”.
2

Move filters earlier in the query

Use additional graph knowledge to make the query more efficient. If you know all relevant pumps are at the same site, move the space filter to the first step. If you know the relevant edges are always type “FLOWS_TO”, add this filter to step 1.Apply these filters early to dramatically reduce the data processed in subsequent steps for better performance.Modified and improved query:

significantHasDataFiltering

Problem: A hasData filter applies to a view composed of many underlying containers. To satisfy the filter, the query engine may perform a join operation for each container to check for data existence. This becomes computationally expensive and slows your query. Solution: Help the query planner optimize your query by adding requires constraints to container definitions used in the query. If you know your data model, for example, that data presence in one container implies data presence in another, use this to help the query engine prune unnecessary joins. To resolve this issue:
1

Identify container dependencies in your data model

Suppose you have view V that maps three containers: A, B, and C. You know that any node with data in container B or C is guaranteed to have data in container A.Without optimization, a hasData filter on V checks for data in A AND B AND C, resulting in multiple joins.
2

Add requires constraints to dependent containers

By defining requires constraints on containers B and C that point to A, you inform the query engine of this dependency. When it sees a hasData filter on V, it understands it only needs to check for data in container A. This simplifies the query, reduces joins, and can significantly improve performance.

unfilteredContainerScan

Problem: A result expression that doesn’t chain from another result expression has hasData filters, but no filter on any property in the matched containers. hasData only checks that an instance has data in a container, so the query engine reads every instance in those containers. The cost grows with the size of the containers, not with the size of the result. Solution: Narrow the scan with a filter on a property in one of the matched containers:
  • Add a selective filter, preferably on an indexed property, in one of the containers that hasData matches.
  • Remove hasData filters that the query doesn’t need to return the right instances.
requires constraints, as described in significantHasDataFiltering, remove redundant joins but don’t make the scan selective. You still need a property filter to resolve this notice.

syncMissingSpaceFilter

Problem: A sync result expression doesn’t filter on a single space. To find the next page of changes, each sync request searches through changes in the entire project. In projects with many writes, this makes sync requests slow and can cause timeouts. Solution: Add an equals filter on space to the sync expression, either as the whole filter or inside a top-level and. An in filter on space doesn’t resolve the notice, even with a single value. To resolve this issue:
1

Add a space filter to the sync expression

Scope the sync to one space:
For edges, filter on ["edge", "space"].
2

Run one sync for each space

If you need changes from several spaces, run a separate sync for each space and keep a separate cursor for each sync. A larger page size or an extra index doesn’t resolve this notice.
Last modified on November 20, 2026