On Tue, Nov 3, 2009 at 1:33 PM, Jani Tiainen <rede...@gmail.com> wrote: > > Low Kian Seong kirjoitti: >> I have about 3k plus record in my db table and am trying to do a >> simple render_to_response of a template sending it the results of a >> query. I debugged this and found that the total time taken for an >> operation like this is 50 seconds! Is there anyway to speed this up? >> > > Answer is maybe.
Model: class defender(models.Model): STATUS_CHOICE=( ('active', 'Active'), ('disabled','Disabled'),) requestor = models.CharField(max_length=50) company = models.CharField(max_length=100) country = models.CharField('Country (User)', max_length=50) ad_domain_group = models.CharField('AD Domain',max_length=50) first_name = models.CharField('First Name', max_length=40) last_name = models.CharField('Last Name', max_length=50) defender_id= models.CharField('Defender ID', max_length=100,primary_key=True) existing_defender_id = models.CharField(max_length=100, editable=False) wifi_password = models.CharField(max_length=100, editable=False) rsa_token_serial_number = models.CharField('Token S/N', max_length=100,null=True,blank=True) token_initial_pin = models.CharField('Token PIN', max_length=10, null=True,blank=True) #vendor = models.ForeignKey('ext_company', verbose_name="Vendor Account") security_question = models.ForeignKey(Question,null=True, blank=True) security_answer = models.CharField(max_length=100, null=True,blank=True) it_manager_id = models.ForeignKey(contact_information, related_name='bew it_manager', verbose_name = ('IT Mgr'), null=True,blank=True,max_length=50) sr_manager_id = models.ForeignKey(contact_information, null=True,blank=True, verbose_name = ('SR Approver'), related_name='bew sr_manager',max_length=50) hd_manager_id = models.ForeignKey(contact_information, related_name='bew hd_manager', verbose_name = ('HD Mgr'), null=True,blank=True,max_length=50) creation_date = models.DateField(max_length=20, db_index=True, null=True,blank=True) disable_date = models.DateField(max_length=20, null=True,blank=True) migrate = models.CharField(max_length=30,editable=False) status = models.CharField(max_length=20, choices=STATUS_CHOICE,default="Active") class Meta: verbose_name_plural = "DEFENDER" class Admin: pass I isolated the code and ran the render_to_response by itself and measured the time. > > First you have to provide model, view and template code you're using to > render your code, second the way you measured this 50 seconds. > > -- > Jani Tiainen > > > > -- Low Kian Seong blog: http://lowkster.blogspot.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---