Re: JOIN instead of multiple SELECT

2010-04-01 Thread bob84123
grr @ google groups for not showing me that this had already been answered... On Apr 2, 10:04 am, bob84123 wrote: > You probably want to check out > select_related:http://docs.djangoproject.com/en/dev/ref/models/querysets/#id4 > > On Apr 1, 7:00 am, Federico Capoano wrote: > > > > > Hello to al

Re: JOIN instead of multiple SELECT

2010-04-01 Thread bob84123
You probably want to check out select_related: http://docs.djangoproject.com/en/dev/ref/models/querysets/#id4 On Apr 1, 7:00 am, Federico Capoano wrote: > Hello to all, > > has been a while i've been wondering how to optimize Django's queries > to the database, for example by setting it to use JO

Re: JOIN instead of multiple SELECT

2010-04-01 Thread Alexander
> * select_related > * only > * extra You also might be interested in "anotate" and "aggregate" http://docs.djangoproject.com/en/dev/topics/db/aggregation/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to dja

Re: JOIN instead of multiple SELECT

2010-04-01 Thread Federico Capoano
What about this solution to generate static files? http://superjared.com/projects/static-generator/ On Apr 1, 12:49 am, Rolando Espinoza La Fuente wrote: > On Wed, Mar 31, 2010 at 5:22 PM, Federico Capoano > > wrote: > > Thanks, > > > how many things i've learnt today, to optimize the number

Re: JOIN instead of multiple SELECT

2010-04-01 Thread Federico Capoano
Very cool, if the database won't be hit often and I manage to use the new template caching functionality added to Django 1.2 the result will be really performant. Thank you very much, I save these info on caching for future reference. On Apr 1, 12:49 am, Rolando Espinoza La Fuente wrote: > On

Re: JOIN instead of multiple SELECT

2010-03-31 Thread Rolando Espinoza La Fuente
On Wed, Mar 31, 2010 at 5:22 PM, Federico Capoano wrote: > Thanks, > > how many things i've learnt today, to optimize the number and length > of query by using: > > * select_related > * only > * extra > > Do you think the performance gain is worth the work? Yes. Specially in loops where you have:

Re: JOIN instead of multiple SELECT

2010-03-31 Thread Federico Capoano
Thanks, how many things i've learnt today, to optimize the number and length of query by using: * select_related * only * extra Do you think the performance gain is worth the work? And I've a curiosity more to ask: If I use the cache framework, once the results are cached the will the database

Re: JOIN instead of multiple SELECT

2010-03-31 Thread Rolando Espinoza La Fuente
On Wed, Mar 31, 2010 at 3:30 PM, Federico Capoano wrote: > Hello to all, > > has been a while i've been wondering how to optimize Django's queries > to the database, for example by setting it to use JOIN to retrieve > foreign keys instead of multiple selects. > > for example if I have a blog objec

JOIN instead of multiple SELECT

2010-03-31 Thread Federico Capoano
Hello to all, has been a while i've been wondering how to optimize Django's queries to the database, for example by setting it to use JOIN to retrieve foreign keys instead of multiple selects. for example if I have a blog object that has a category foreign key and I write in a template {{ blog.c