Make the getSingleResult()
add limit to the query
#5379
francescortiz
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
Generally speaking, there is a problem with
Yes, in other words, you need to be explicit with knex, just like with MikroORM. But I agree we should probably do this |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem? Please describe.
When you invoke
getSingleResult()
you expect.limit(1)
to be added to the query. Since this is not happening, this leads to unforeseen performance issues.Describe the solution you'd like
.getSingleResult()
should add.limit(1)
to the query..execute('get')
shoudl add.limit(1)
to the query.Maybe the best approach can be to make
.getSingleResult()
withlimit == 1
call.execute('get')
instead of.execute('all')
and put this optimization only there.Additional context
knex does this when you invoke
.first()
Beta Was this translation helpful? Give feedback.
All reactions