Skip to content
Open
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 @@ -33,3 +33,7 @@
## 2025-05-27 - [Bulk SQLite Inserts and Connection Reuse for Tagging]
**Learning:** Sequential `.execute` calls for `INSERT OR REPLACE` inside nested loops over large arrays (like tags) coupled with opening independent DB connections per method creates a severe N+1 problem. Benchmarks showed replacing it with a single shared connection and `executemany` arrays resulted in an ~2x speedup on typical batch tagging workloads.
**Action:** Always batch related SQL records using `.executemany()` and pass an optional `db_connection` downstream to nested operations instead of establishing a new database connection every time.

## 2025-05-28 - [Fixing Invalid SQLite PRAGMA Values]
**Learning:** In SQLite configurations within the project, `PRAGMA mmap_size` must be set to a valid integer byte size (e.g., `268435456` for 256MB). Invalid strings fail silently and disable memory-mapped I/O.
**Action:** Always verify PRAGMA values are correct integers and test database configurations directly.
2 changes: 1 addition & 1 deletion local_metadata_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def _get_connection(self) -> sqlite3.Connection:
self._local.connection.execute("PRAGMA synchronous=NORMAL")
self._local.connection.execute("PRAGMA cache_size=10000")
self._local.connection.execute("PRAGMA temp_store=MEMORY")
self._local.connection.execute("PRAGMA mmap_size=XXXXXXXXX") # 256MB
self._local.connection.execute("PRAGMA mmap_size=268435456") # 256MB

# Enable foreign keys
self._local.connection.execute("PRAGMA foreign_keys=ON")
Expand Down
Loading