On 7/9/06, Paul <[EMAIL PROTECTED]> wrote: > 1) do something like > 'UserProfile.objects.filter(subscriptions=obj).count()' > 2) Keep a subscription count on each StorySection object. Adding one > when somebody subscribes and subtracting when they unsubscribe. > > 1 is obviously simpler, pushing work onto the database > 2 seems to me that it would be faster, but you're updating objects more > often.
2 is asking for trouble because of inconsistencies. If you're happy with an estimate, well, OK. But... > Is counting the number of objects that meet a particular criterea > likley to be a heavyweight task for the database (say to a maximum > table size of about 100K rows) No, especially if the FK field is indexed (which it should be anyway, depending on your backend). DBs are rediculously tuned, and it's not likely you could do a lot better. And assuming you have a reasonable server, 100K rows is really not a big table. :) But, as ever, measure it and see. ;-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---

