Friday, February 3, 2012

Re: about QuerySet

On Feb 3, 5:52 am, newme <dllizh...@gmail.com> wrote:
> so it means when i call user[1] after user[0], it is possible that i
> will get same record if someone else insert a new record into database
> between 2 calls.

Actually, there doesn't need to be an insert between the calls if you
don't use .order_by(). Technically, without an ORDER BY the database
is free to return the records in any order it wishes, even if there
are no inserts in between.

I think you really should fetch all the needed objects in one go. That
is the correct way to do what you need. And in addition it is more
efficient.

- Anssi

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate