gabor wrote:

> which way do you chose-usually/recommend?

I would go with the custom query.  This is the DRY principle (see
http://www.djangoproject.com/documentation/design_philosophies/#don-t-repeat-yourself-dry
): don't write down any data more than once.

The exception is when you actually see performance hurting, or you can
prove to yourself that performance is going to hurt.  Then you use a
performance-improving technique.  In this case, the likely technique is
to cache some values, probably exactly those extra values you were
keeping around.  But make it explicit that it's a cache, and make it a
well-behaved cache.  That means that you have ways of detecting when
your cache is no longer valid, and that you can always cope if you
don't have a valid cache.  For your stuff, I would invalidate the cache
whenever a Recipient's save() method is called.  Then, the next time
something needs to find out how many Recipients are pending, it would
recalculate it the expensive way and cache the results for the next
time someone needed it.

- Terry


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to