perf: count folder files from a covering index

This commit is contained in:
Codex committed 2026-11-11 09:05:30 +00:00
1 parent a6e5696746
commit 1505fd2baa
4 files changed
+34 -6

No files matched your search

@@ -14,6 +14,7 @@ async function main() {
// Additive only. Never use syncIndexes here, which can drop deployed indexes.
await Repository.collection.createIndex({ "coauthors.githubId": 1 });
await File.collection.createIndex({ repoId: 1, treeGeneration: 1, path: 1, name: 1 });
await File.collection.createIndex({ repoId: 1, treeGeneration: 1, path: 1, size: 1 }, { name: "file_counts_covering" });
await File.collection.createIndex({ metadataPending: 1, repoId: 1, treeGeneration: 1 },
{ partialFilterExpression: { metadataPending: true } });
await Repository.collection.createIndex({ retiredTreeGenerations: 1 }, { sparse: true });