Re: Help optimising database calls

2011-01-12 Thread Matt Henderson
I managed to improve the speed of the site by using memcached to cache the rendered Thread views M On 12 January 2011 16:23, Matt Henderson wrote: > Thanks Lukasz and Matias, > I've implemented something along those lines in my view: > > threads = > list(Thread.objects.se

Re: Help optimising database calls

2011-01-12 Thread Matt Henderson
Thanks Lukasz and Matias, I've implemented something along those lines in my view: threads = list(Thread.objects.select_related('author').all().order_by('-created'))[:150] threads_map = {} for t in threads: threads_map[t.pk] = t t.pun_collection = [] for pun in Pun.objects.all().filt

Help optimising database calls

2011-01-12 Thread Matt Henderson
Hello, I'm new to django, and set up a website recently, (puncut.com). I was hoping someone might be able to explain how to optimise database calls because at the moment some pages are taking 5 seconds before django responds. I'll summarise the scenario below: # models class Thread(models.Model)