edgedb-js icon indicating copy to clipboard operation
edgedb-js copied to clipboard

Automatic parameter extraction with Query Builder

Open scotttrinh opened this issue 2 years ago • 2 comments

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.

scotttrinh avatar Sep 01 '23 16:09 scotttrinh

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 avatar Feb 18 '24 02:02 awerlogus

@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.

scotttrinh avatar Mar 12 '24 20:03 scotttrinh