Skip to content

⚑ Bolt: Add database index for sourceBundleId#3

Merged
kiku-jw merged 1 commit into
mainfrom
bolt/optimization/source-bundle-index-7216602016479896066
Dec 24, 2025
Merged

⚑ Bolt: Add database index for sourceBundleId#3
kiku-jw merged 1 commit into
mainfrom
bolt/optimization/source-bundle-index-7216602016479896066

Conversation

@google-labs-jules
Copy link
Copy Markdown
Contributor

Added database index for sourceBundleId to improve performance of app-based filtering and exports.


PR created automatically by Jules for task 7216602016479896066 started by @kiku-jw

πŸ’‘ What:
Added a new SQLite index `idx_items_sourceBundleId` on the `items` table.
Updated schema version to 2 and added migration logic to apply the index to existing databases.
Updated initial schema creation to include the index for new installations.

🎯 Why:
The application frequently filters items by `sourceBundleId` (e.g., in `getUniqueApps()` and `fetchForExport(bundleIds:)`).
Without an index, these queries perform a full table scan, which degrades performance as the history grows (up to 50,000 items).

πŸ“Š Impact:
- Transforms O(n) table scans into O(log n) index lookups for app-based filtering.
- Significantly speeds up the "Selected Apps" export workflow and the population of the app filter list in Settings.
- Reduces database I/O for these operations.

πŸ”¬ Measurement:
- Verify that `PRAGMA user_version` is 2 after launch.
- Verify that `EXPLAIN QUERY PLAN SELECT ... WHERE sourceBundleId = ...` uses the new index.
@google-labs-jules
Copy link
Copy Markdown
Contributor Author

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@kiku-jw kiku-jw marked this pull request as ready for review December 24, 2025 11:27
@kiku-jw kiku-jw merged commit a20171d into main Dec 24, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant