After having seen this I wrote up https://github.com/fzakaria/calcite-git to demo doing this easily in Java using Apache Calcite
> the goal is to be able to expose more powerful planning optimizations, and simpler code.
an aspect of the sqlite virtual table feature (which askgit uses) is the ability to define "indexes" to avoid full "table scans" when the query is executed - depending on WHERE clause constraints.
I've seen calcite and would love to try it out! I just haven't written much java lately
So I could push down filters to Git itself if that makes the scans any faster.