New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entity.get() should issue 'limit 2' #83

Closed
socketpair opened this Issue Oct 13, 2014 · 2 comments

Comments

Projects
None yet
2 participants
@socketpair
Copy link

socketpair commented Oct 13, 2014

One of the purposes of entity.get() is to detect MultipleObjectsFoundError. If you add limit 2 to SQL queries, SQL server can use less resources while executing the query. For example, SQL server can stop populating internal cache if only two records needed. Yes I know that we may use cursors, but still sure that limit 2 will not hurt in performance in any way.

@kozlovsky kozlovsky self-assigned this Oct 13, 2014

@kozlovsky

This comment has been minimized.

Copy link
Member

kozlovsky commented Oct 13, 2014

Agreed, should be fixed

@kozlovsky kozlovsky closed this in 564a706 Oct 28, 2014

@kozlovsky

This comment has been minimized.

Copy link
Member

kozlovsky commented Oct 28, 2014

Now Pony adds LIMIT 2 when it thinks that a query can return more than one row. But when Pony sees that the query uses an unique key and thus no duplicates are possible, then LIMIT 2 will not be added, because it looks redundant and shouldn't influence anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment