- changed status to wontfix
uselist=False doesn't LIMIT 1
on Mapper() i have relation() i use primaryjoin, and uselist=False, but i also want to have LIMIT=1 on my join it would be much faster!! SA should add the limit itself when uselist=False
since I set up uselist=False it is obvious that JOIN should be limited to 1, this wil bring a performance boost!
Comments (6)
-
repo owner -
Account Deleted ok, but even if it is for One-to-One , LIMIT 1 will make it work faster for some DB and adding limit=X feature IMHO will be a benefit.
-
Account Deleted - removed status
- changed status to open
I was browsing the relation() code and i think that there will not be much efford tplace an aditional parameter "limit" to it will it? aditionaly I think, that uselist tells that there will be only 1 object related. AFAIK LIMIT here will be helpfull and it will reduce the query time. i think that or uselist false and default limit 1 or aditional limit parameter should be considered.
-
repo owner LIMIT is not supported by every database and for a DB like oracle, will add significant overhead as well as reduce stability since Oracle has to produce a nested subquery in order to simulate LIMIT. I'm also skeptical that placing a LIMIT on a result set that is only one row in the first place has any positive effect, do you have any source to back this up ?
-
I'm closing this. I can't see any reason why a limit 1 would make sense here. If you can show performance tests that indicate it makes a difference we can consider it but I doubt that's the case. Also as zzzeek said LIMIT is not supported everywhere, which complicates things.
-
repo owner - removed milestone
Removing milestone: 0.5.xx (automated comment)
- Log in to comment
this is not the use case for uselist=False. See my response to this on the ML at:
http://groups.google.com/group/sqlalchemy/browse_thread/thread/c2665c19cb6fafe7