edgedb-js
edgedb-js copied to clipboard
Automatic parameter extraction with Query Builder
We often have queries built with the query builder where literals are inlined into the query itself. That is typically fine, but if you have a large array or json inlined, the server spends a bunch of time tokenizing it. It should be extracted into a parameter, and we should be able to detect at least these bad cases.
The reason why I do not use parametrized queries is that they cannot be embedded inside other queries. Is it possible to allow this? If so, the optimization suggested in the issue is not necessary.
@awerlogus
Some story for improving the composability of query builder expressions that take parameters is definitely high up on the priority list of things to figure out. Nothing to share on this yet, but it's definitely on our radar.
Even with that, we can and should still automatically parameterize anything we can to improve performance since the EdgeDB server caches query compilation and inline literals defeat this caching strategy.