larkery / zsh-histdb

A slightly better history for zsh
MIT License
1.25k stars 74 forks source link

create index on history(place_id, command_id) #106

Closed phiresky closed 2 years ago

phiresky commented 3 years ago

For queries in a specific directory adding this index:

create index history_place_command on history(place_id, command_id);

improves perf a lot since then SQLite can first get all relevant place_ids and then check the history for that place instead of going through the whole history and filtering out places.

For me this makes a query like histdb --in $PWD go from 0.4 seconds to being instant.

larkery commented 2 years ago

This looks like a good idea, I'll do it. Thanks.

larkery commented 2 years ago

actually looks like this is already in there and this comment is old!