Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@

**Learning:** Independent DB queries in Server Components often default to serial execution (waterfall). Always wrap independent queries in `Promise.all`. Fetching large datasets just to count them (e.g. `array.length`) is an anti-pattern; use `count()` in SQL instead.
**Action:** Audit page loaders for serial `await` calls on independent data and replace array-based counting with SQL aggregation.

## 2025-02-14 - Composite Index Optimization
**Learning:** Replacing an index on `(A)` with `(A, B)` is a safe optimization when queries filter by `A` and sort by `B`. It allows the DB to fetch pre-sorted data, avoiding a sort operation, while still supporting lookups on `A`.
**Action:** Always check if a frequently sorted column can be added to an existing filter index to create a composite index.
3 changes: 3 additions & 0 deletions drizzle/0002_sour_madripoor.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DROP INDEX "idx_issue_comments_issue_id";--> statement-breakpoint
CREATE INDEX "idx_issue_comments_issue_id_created_at" ON "issue_comments" USING btree ("issue_id","created_at");--> statement-breakpoint
CREATE INDEX "idx_machines_name" ON "machines" USING btree ("name");
Loading
Loading