Query building optimization question
Hello, Id like some input from Kysely advanced users about my approach to using the
eb
. If I have a conditional select query, is this efficiently using the eb
object for my query? Is it ok to use multiple levels of eb
s ?
Solution:Jump to solution
Creating an expression builder instance is in the order of microseconds. Running the query is in the order of milliseconds or hundreds of milliseconds. You don't need to worry about expression builder instances unless you create a thousand of them per query.
3 Replies
Solution
Creating an expression builder instance is in the order of microseconds. Running the query is in the order of milliseconds or hundreds of milliseconds. You don't need to worry about expression builder instances unless you create a thousand of them per query.
Always benchmark things before you optimize them.
If optimizing means otherwise worse code or takes time away from doing meaningful things
thanks for the insights, yeah it was pretty performant as is just wondering if the Kysely convention was different. Cant overstate how great the library is tbh