Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Storage: Add Indexes for common queries
In #306 it's reported that SQLite is slow. This adds indexes so lookups will be faster. The intention is to speed up the bottom 3 queries from #306 (comment) as they are "the ones to focus on". Specifically this should speed up: > * Load graph data for a file > > SELECT value FROM graphs WHERE file = ? > > Called many times during path stitching > > * Load paths for a file node > > SELECT file,value from file_paths WHERE file = ? AND local_id = ? > > Called many times during path stitching. > > * Load paths for root node > > SELECT file, value from root_paths WHERE symbol_stack = ? > > Called many times during path stitching. If the data that you're fetching is in the index then SQLite won't even bother reading the row proper, just pulling the data streight from the index (good for data locality). As such I've included not just the columns we're using in the `WHERE` clause, but also the ones from `SELECT` too. I've not actually tested the performance impact as I'm not familiar with this project (this is more of a drive-by) and don't know what benchmarks to use.
- Loading branch information