Hi,

I have these models (not really but it's to explain my question :))

class Calendar(models.Model):
    name = models.CharField(max_length=60)
    description = models.TextField(blank=True)
    appointment = models.ManyToManyField(Appointment, 
related_name='appointment_set')

class Appointment(models.Model):
    name = models.CharField(max_length=60)
    description = models.TextField(blank=True)
    owner = models.ForeignKey(User, related_name='owner_set')

If I want to show the Calendars of the logged in user, I would have to itterate 
the calendar objects,
getting the related appointments and from there the user.
If the users match, I know it's a calendar of the logged in user.

If the user has more than 1 calendar, this might really be a costly search.
I know this might not be a good usecase but it's to understand the cost of 
searching.

If I add a ForeignKey field to Calendar, the search seems a lot simpler.
However you're storing data that is known through the appointment relation.

With adding the extra Foreignkey field to Calendar, the search is simpler but 
is it also faster?

Can you test this with testsuite of Django?

Thanks for any info,
Benedict

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to