but not sure about db query performance if I’ll wrap initial query to N nested subqueries
Great idea indeed, but not sure about db query performance if I’ll wrap initial query to N nested…
Stealing Fat
1

Hi! And thanks for the response 😁

You’re right, this could hurt performance but probably much fixable than other query builders since we can isolate the sub queries and fix their score one at a time. Plus, the queries are in pure SQL so an experienced DBA can help with the query performance.

That being said, I know that long running projects like ActiveRecord are battle tested and they got lots of eyes benchmarking and fixing performance issues.

I think the best (and the worst) thing about my method is that it’s not opinionated at all, what could lead to better performance on every specific application, e.g pagination custom logic or usage of stored procedures.

If our Query class has limit, pagination and conditionsā€Šā€”ā€Šit becomes a solution to very specific use case. What about JOINs and stored procedures? Using custom indexes? No matter how well we build it, JSQL, our JavaScript-to-SQL DSL, will be weaker than SQL since we have to implement a nice DSL for every database implementation and feature. Moreover, we couldn’t compose queriesā€Šā€”ā€Šso I’ll probably repeat myself in many queries.

Thanks for the response again 😁