Show HN: ClangQL – Query C++ codebases using SQLite
github.com
github.com
EDIT: also, doing things this way you don't need to reimplement C++ indexing because you can leverage the existing clang features
The issue is that SQLite considers the entire table when doing query plans, rather than the specific query that's about to be performed; this means if D is especially short, then it'll choose D as the "driver" table, and then linearly scan A, B, and C. This is not the behavior is uses for its own internal tables. Instead, internal tables are log-scanned based off the "best" table.
I suppose, what I'd really like is a strong guarantee that the plans SQLite compiled always used the index. I understand that there's N! possible plan orders for a join, so we can't consider all orders, but whatever mechanism is exposed through `xBestIndex` is just bonkers bad.
- LLVM provides a remote interface to their index accessible through a gRPC connection
- The clangd protocol is very simple, and the bindings can be generated automatically
I don't know enough about LSP to say whether it would be a suitable protocol to use for this purpose