Re: [Django] #9394: Reverse relation lookups with a multi-table inherited model produces extraneous queries

2016-09-23 Thread Django
#9394: Reverse relation lookups with a multi-table inherited model produces
extraneous queries
-+-
 Reporter:  Ian Kelly|Owner:  (none)
 Type:   |   Status:  closed
  Cleanup/optimization   |
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  duplicate
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham):

 * status:  new => closed
 * resolution:   => duplicate


Comment:

 Looks like a duplicate of #15844.

 (Fixed in Django 1.6 with 97774429aeb54df4c09895c07cd1b09e70201f7d and a
 test added in fa2e1e633ac2073906ed3f1f32107d02331107aa.)

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.dcf4f9177b92ca1e25a6e6fa537e918c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #9394: Reverse relation lookups with a multi-table inherited model produces extraneous queries

2013-01-17 Thread Django
#9394: Reverse relation lookups with a multi-table inherited model produces
extraneous queries
-+-
 Reporter:  ikelly   |Owner:
 Type:   |  mtredinnick
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:   |  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  1
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by akaariai):

 I just verified that this we still generate extra queries in this case.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #9394: Reverse relation lookups with a multi-table inherited model produces extraneous queries

2011-04-17 Thread Django
#9394: Reverse relation lookups with a multi-table inherited model produces
extraneous queries
-+-
   Reporter:  ikelly |Owner:  mtredinnick
   Type: |   Status:  assigned
  Cleanup/optimization   |Component:  Database layer
  Milestone:  1.3|  (models, ORM)
Version:  SVN| Severity:  Normal
 Resolution: | Keywords:
   Triage Stage:  Accepted   |Has patch:  1
Needs documentation:  0  |  Needs tests:  0
Patch needs improvement:  1  |
-+-
Changes (by julien):

 * needs_better_patch:  0 => 1
 * type:   => Cleanup/optimization
 * severity:   => Normal


Comment:

 The tests would need to be rewritten using unittests since this is now
 Django's preferred way.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #9394: Reverse relation lookups with a multi-table inherited model produces extraneous queries

2010-03-08 Thread Django
#9394: Reverse relation lookups with a multi-table inherited model produces
extraneous queries
---+
  Reporter:  ikelly| Owner:  mtredinnick
Status:  assigned  | Milestone:  1.3
 Component:  Database layer (models, ORM)  |   Version:  SVN
Resolution:|  Keywords: 
 Stage:  Accepted  | Has_patch:  1  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Changes (by Alex):

  * milestone:  1.2 => 1.3

Comment:

 Likewise, pushing to 1.3: this is an optimization, not a bug.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #9394: Reverse relation lookups with a multi-table inherited model produces extraneous queries

2009-05-07 Thread Django
#9394: Reverse relation lookups with a multi-table inherited model produces
extraneous queries
---+
  Reporter:  ikelly| Owner:  mtredinnick
Status:  assigned  | Milestone:  1.2
 Component:  Database layer (models, ORM)  |   Version:  SVN
Resolution:|  Keywords: 
 Stage:  Accepted  | Has_patch:  1  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Changes (by jacob):

  * milestone:  1.1 => 1.2

Comment:

 Pushing to 1.2: this is an optimization, not a bug.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #9394: Reverse relation lookups with a multi-table inherited model produces extraneous queries

2009-05-07 Thread Django
#9394: Reverse relation lookups with a multi-table inherited model produces
extraneous queries
---+
  Reporter:  ikelly| Owner:  mtredinnick
Status:  assigned  | Milestone:  1.1
 Component:  Database layer (models, ORM)  |   Version:  SVN
Resolution:|  Keywords: 
 Stage:  Accepted  | Has_patch:  1  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Changes (by apollo13):

  * has_patch:  0 => 1

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #9394: Reverse relation lookups with a multi-table inherited model produces extraneous queries

2009-05-04 Thread Django
#9394: Reverse relation lookups with a multi-table inherited model produces
extraneous queries
---+
  Reporter:  ikelly| Owner:  mtredinnick
Status:  assigned  | Milestone:  1.1
 Component:  Database layer (models, ORM)  |   Version:  SVN
Resolution:|  Keywords: 
 Stage:  Accepted  | Has_patch:  0  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Comment (by JasonCreighton):

 It's worth noting that in some circumstances, this bug can drastically
 increase the number of queries run. For instance, each time an instance of
 a model that uses inheritance is displayed in a form using a
 ModelChoiceField, an extra query is run. So if you display 50 items in
 select box, 51 queries will be run. (1 for the initial list, and an extra
 query for each item in the list.)

 It becomes even worse if you have multiple select boxes, as you might with
 an inline formset, since the extra query will be run for '''each''' item
 in '''each''' select box, which can easily lead to hundreds of unnecessary
 queries being run.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #9394: Reverse relation lookups with a multi-table inherited model produces extraneous queries

2009-03-23 Thread Django
#9394: Reverse relation lookups with a multi-table inherited model produces
extraneous queries
---+
  Reporter:  ikelly| Owner:  mtredinnick
Status:  assigned  | Milestone:  1.1
 Component:  Database layer (models, ORM)  |   Version:  SVN
Resolution:|  Keywords: 
 Stage:  Accepted  | Has_patch:  0  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Changes (by mtredinnick):

  * milestone:  => 1.1

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #9394: Reverse relation lookups with a multi-table inherited model produces extraneous queries

2009-02-13 Thread Django
#9394: Reverse relation lookups with a multi-table inherited model produces
extraneous queries
---+
  Reporter:  ikelly| Owner:  mtredinnick
Status:  assigned  | Milestone: 
 Component:  Database layer (models, ORM)  |   Version:  SVN
Resolution:|  Keywords: 
 Stage:  Accepted  | Has_patch:  0  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Comment (by Alex):

 If the decision on 10251 is that it's disallowed(which I personally favor)
 then the patch I supplied should work fine and remedy the issue.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #9394: Reverse relation lookups with a multi-table inherited model produces extraneous queries

2009-02-13 Thread Django
#9394: Reverse relation lookups with a multi-table inherited model produces
extraneous queries
---+
  Reporter:  ikelly| Owner:  mtredinnick
Status:  assigned  | Milestone: 
 Component:  Database layer (models, ORM)  |   Version:  SVN
Resolution:|  Keywords: 
 Stage:  Accepted  | Has_patch:  0  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Comment (by JasonCreighton):

 See #10251 in relation to having a separate primary key for the child
 class.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #9394: Reverse relation lookups with a multi-table inherited model produces extraneous queries

2009-02-13 Thread Django
#9394: Reverse relation lookups with a multi-table inherited model produces
extraneous queries
---+
  Reporter:  ikelly| Owner:  mtredinnick
Status:  assigned  | Milestone: 
 Component:  Database layer (models, ORM)  |   Version:  SVN
Resolution:|  Keywords: 
 Stage:  Accepted  | Has_patch:  0  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Comment (by Alex):

 On further review this patch would break when you have an subclass that
 has a primary key that isn't the parent link, is that allowed?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #9394: Reverse relation lookups with a multi-table inherited model produces extraneous queries

2009-02-13 Thread Django
#9394: Reverse relation lookups with a multi-table inherited model produces
extraneous queries
---+
  Reporter:  ikelly| Owner:  mtredinnick
Status:  assigned  | Milestone: 
 Component:  Database layer (models, ORM)  |   Version:  SVN
Resolution:|  Keywords: 
 Stage:  Accepted  | Has_patch:  0  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Comment (by JasonCreighton):

 I'm running into what I think is the same bug. I'm using 1.0.2. Given
 these models:

 {{{
 class Base(models.Model):
 base_info = models.CharField(max_length=50)

 class Extra(Base):
 extra_info = models.CharField(max_length=50)

 class ExtraRelatedData(models.Model):
 extra = models.ForeignKey(Extra)
 related_data = models.CharField(max_length=50)
 }}}

 And some pre-populated data:

 {{{
 >>> e = Extra(base_info="foo", extra_info="bar")
 >>> e.save()
 >>> ed = ExtraRelatedData(extra=e, related_data="quux")
 >>> ed.save()
 }}}

 If I later run:

 {{{
 >>> e = Extra.objects.get(pk=1)
 >>> ExtraRelatedData.objects.filter(extra=e)
 []
 >>> for q in connection.queries: print repr(q)
 ...
 {'time': '0.001', 'sql': u'SELECT
 "inheritance_base"."id", "inheritance_base"."base_info",
 "inheritance_extra"."base_ptr_id", "inheritance_extra"."extra_info"
 FROM "inheritance_extra"
 INNER JOIN "inheritance_base" ON ("inheritance_extra"."base_ptr_id" =
 "inheritance_base"."id")
 WHERE "inheritance_extra"."base_ptr_id" = 1 '}
 {'time': '0.000', 'sql': u'SELECT
 "inheritance_base"."id", "inheritance_base"."base_info"
 FROM "inheritance_base" WHERE "inheritance_base"."id" = 1 '}
 {'time': '0.000', 'sql': u'SELECT
 "inheritance_extrarelateddata"."id",
 "inheritance_extrarelateddata"."extra_id",
 "inheritance_extrarelateddata"."related_data"
 FROM "inheritance_extrarelateddata"
 WHERE "inheritance_extrarelateddata"."extra_id" = 1  LIMIT 21'}
 }}}

 Even though "e" is already loaded, Django loads it again. (To get the pk?)
 I can workaround it like so:

 {{{
 >>> e = Extra.objects.get(pk=1)
 >>> ExtraRelatedData.objects.filter(extra__pk=e.pk)
 []
 >>> for q in connection.queries: print repr(q)
 ...
 {'time': '0.001', 'sql': u'SELECT
 "inheritance_base"."id", "inheritance_base"."base_info",
 "inheritance_extra"."base_ptr_id", "inheritance_extra"."extra_info"
 FROM "inheritance_extra"
 INNER JOIN "inheritance_base" ON ("inheritance_extra"."base_ptr_id" =
 "inheritance_base"."id")
 WHERE "inheritance_extra"."base_ptr_id" = 1 '}
 {'time': '0.000', 'sql': u'SELECT
 "inheritance_extrarelateddata"."id",
 "inheritance_extrarelateddata"."extra_id",
 "inheritance_extrarelateddata"."related_data"
 FROM "inheritance_extrarelateddata"
 WHERE "inheritance_extrarelateddata"."extra_id" = 1  LIMIT 21'}
 }}}

 [ SQL reformatted slightly ]

 It seems completely wrong to me that there's a case where
 {{{filter(foo=foo)}}} is not that same as {{{filter(foo__pk=foo.pk)}}}.

 So is this the same bug, or should I open a new ticket?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #9394: Reverse relation lookups with a multi-table inherited model produces extraneous queries

2008-10-24 Thread Django
#9394: Reverse relation lookups with a multi-table inherited model produces
extraneous queries
---+
  Reporter:  ikelly| Owner:  mtredinnick
Status:  assigned  | Milestone: 
 Component:  Database layer (models, ORM)  |   Version:  SVN
Resolution:|  Keywords: 
 Stage:  Accepted  | Has_patch:  0  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Changes (by mtredinnick):

  * summary:  Querying a many-to-many intermediate model from a manager on
  a multi-table inherited model produces
  extraneous queries => Reverse relation lookups
  with a multi-table inherited model produces
  extraneous queries

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---