Re: Optimizing queries

2009-11-08 Thread Tomasz Zieliński
On 8 Lis, 18:06, Victor wrote: > Hi, > > > user_item_rel_set is a m2m relationship between the User and Item > class.  For every item, I look back at its m2m relationship model and > retrieve payment_amount.  The only problem is, select_related() > doesn't grab the user_item_rel_set.all() when I

Optimizing queries

2009-11-08 Thread Victor
Hi, I'm trying to optimize some queries I'm making, but I'm not sure how to do it. 61 for t in items: 62 try: 63 t.price = t.user_item_rel_set.get (user=u).payment_amount 64 except: 65 t.price = -1 * t.buyer

Re: optimizing queries

2007-01-29 Thread Jam
I think using SQL could be quite database independant though less readable. Anyway, executing a count query for each "TagName" is not acceptable. So if there's no "django way" to do that, I would recommand SQL --~--~-~--~~~---~--~~ You received this message bec

optimizing queries

2007-01-29 Thread [EMAIL PROTECTED]
Hi, sometimes I find myself in a need of raw sql, for example when joining tables that don't have explicit related fields. In those cases "extra" method comes in really handy. For example I have following models. class TagName(models.Model): name = model.CharField() class Tag(models.Model):