Skip to content

Commit a3c986c

Browse files
committed
fix(db): index the keyword projection by document for the ACL fan-out trigger
The document ACL trigger updates the keyword projection by document id; the projection had no index on that column, so every document ACL or source change scanned the whole projection. Adds the index concurrently.
1 parent aadebe0 commit a3c986c

4 files changed

Lines changed: 28462 additions & 15 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- The document ACL trigger fans a document's source and ACL out to the keyword projection by
2+
-- document id; with no index on that column every ACL change scanned the whole projection.
3+
COMMIT;--> statement-breakpoint
4+
SET lock_timeout = 0;--> statement-breakpoint
5+
CREATE INDEX CONCURRENTLY IF NOT EXISTS "embedding_keyword_tin_document_idx" ON "embedding_keyword_tin" USING btree ("document_id");--> statement-breakpoint
6+
SET lock_timeout = '5s';

0 commit comments

Comments
 (0)