On 7/25/06, Michael Radziej <[EMAIL PROTECTED]> wrote:
> Wouldn't self.genres.all()[:1].count() save the database engine some
> work?

If you go that route, you don't need the count() anymore; slicing
forces the QuerySet to be evaluated.

Doing a SELECT COUNT(*) is pretty cheap, though, and DBs probably have
really good optimization for it, so I'd say it's a tossup as to which
method is least stressful for the database.

> Actually, an good exists() method for QuerySet would be handy!

Ideally, just doing any sort of boolean test on a QuerySet would force
it to evaluate; adding a __nonzero__ method to QuerySet would
accomplish that, and the docs on when QuerySets are evaluated could be
changed to reflect it.

I think I'll file a ticket.

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to