You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable auto-indexing for nested field paths (#728)
* fix: enable auto-indexing for nested field paths
This fix allows auto-indexes to be created for nested field paths
(e.g., `profile.score`, `metadata.stats.views`), not just top-level
fields. This resolves performance issues where queries with `eq()`,
`gt()`, etc. on nested fields were forced to do full table scans
instead of using indexes.
Changes:
- Remove the `fieldPath.length !== 1` restriction in `extractIndexableExpressions()`
- Update `ensureIndexForField()` to properly traverse nested paths when creating index accessors
- Add comprehensive tests for nested path auto-indexing with 1, 2, and 3-level nesting
- Verify that nested path indexes are properly used by the query optimizer
Fixes#727
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: use colon-prefixed naming for auto-indexes to avoid conflicts
Change auto-index naming from 'auto_field_path' to 'auto:field.path'
to prevent ambiguity between nested paths and fields with underscores.
Examples:
- user.profile -> auto:user.profile
- user_profile -> auto:user_profile
(no conflict!)
Co-authored-by: Sam Willis <sam.willis@gmail.com>
* chore: add changeset for nested auto-index fix
* style: format changeset with prettier
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Sam Willis <sam.willis@gmail.com>
Previously, auto-indexes were only created for top-level fields. Queries filtering on nested fields like `vehicleDispatch.date` or `profile.score` were forced to perform full table scans, causing significant performance issues.
8
+
9
+
Now, auto-indexes are automatically created for nested field paths of any depth when using `eq()`, `gt()`, `gte()`, `lt()`, `lte()`, or `in()` operations.
10
+
11
+
**Performance Impact:**
12
+
13
+
Before this fix, filtering on nested fields resulted in expensive full scans:
14
+
15
+
- Query time: ~353ms for 39 executions (from issue #727)
16
+
- "graph run" and "d2ts join" operations dominated execution time
0 commit comments