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
Refs: #73 Enhance performance and indexing for MongoDB persistence
- Added performance notes for per-stream read queries in Changelog.md
- Introduced explain audit script for validating index usage in MongoDB
- Implemented tests to ensure expected indexes are used for various queries
- Added MongoDB snapshot indexes for improved snapshot retrieval
- Refactored MongoPersistenceEngine to optimize query filters and sorting
| Duplicate conflict slice |`DuplicateCommitIdPath` (`Iterations=100`) | 683.60 ms |
272
261
262
+
## Explain Audit Workflow
263
+
264
+
Use the explain audit script to validate the index usage of the persistence engine query shapes against a local MongoDB container:
265
+
266
+
```powershell
267
+
.\scripts\explain-persistence-engine.ps1
268
+
```
269
+
270
+
The script seeds a scratch database, recreates the same indexes defined by the engine, and runs `explain("executionStats")` for the main `Find` and equivalent delete/update filter shapes in `MongoPersistenceEngine`.
271
+
272
+
Current findings from the issue [#73](https://github.com/NEventStore/NEventStore.Persistence.MongoDB/issues/73) follow-up:
273
+
274
+
- The changed query shapes for stream reads, snapshot reads, snapshot deletes, and bucket-scoped stream-head reads all use the intended indexes.
275
+
- Bucket checkpoint scans and duplicate-commit lookups also use the expected indexes.
276
+
- The legacy date-based bucket reads and all-buckets checkpoint scans remain less ideal query shapes and should be reviewed separately if they become performance-sensitive.
277
+
- Decision: do not add a new `CommitStamp`-oriented compound index for the obsolete `GetFrom(bucketId, DateTime)` and `GetFromTo(bucketId, DateTime, DateTime)` APIs. They are sync-only compatibility methods on an upstream obsolete contract, they are already documented for removal, and the preferred checkpoint-based APIs are the supported optimization target.
278
+
273
279
### After Snapshot Template
274
280
275
281
After implementing optimizations, run the same net10 baseline profile and fill this table using the same method/parameter rows selected from the "before" reports.
@@ -279,8 +285,8 @@ After implementing optimizations, run the same net10 baseline profile and fill t
0 commit comments