You might be interested in https://github.com/ellie/atuin
> Atuin replaces your existing shell history with a SQLite database, and records additional context for your commands.
If you haven’t run across Atuin yet you might like it! https://github.com/ellie/atuin
It stores shell history in a SQLite database and you can use Ctrl+R to fuzzy search it.
https://github.com/ellie/atuin is a TUI with the added option of syncing history between shells and machines.