We had similar problem a few months ago, one join in only two tables (but
those two tables were big, very big) we solve the problem denormalizing the
table. So everytime we save some row for table1, we update the table2 with
a column table1_name_cache. In the list, we display this column.
On
Also how can I use "select_related()" for admin?
Should I put it in admin.py or settings like a setting or how?
thanks
On Wednesday, 26 September 2012 10:16:29 UTC-4, rentgeeen wrote:
>
> Here is mysql profiling:
>
> Results:
>
> Query:
>
> http://cl.ly/image/0311392u0Z0S
>
> CPU Profile:
>
>
Here is mysql profiling:
Results:
Query:
http://cl.ly/image/0311392u0Z0S
CPU Profile:
http://cl.ly/image/2D210h0f1L06
On Wednesday, 26 September 2012 09:38:03 UTC-4, rentgeeen wrote:
>
> If you want I can send you a zip of the project
>
> On Wednesday, 26 September 2012 09:34:33 UTC-4,
If you want I can send you a zip of the project
On Wednesday, 26 September 2012 09:34:33 UTC-4, rentgeeen wrote:
>
> Here is the SQL again it overlap in previous post dont know why it posted
> twice:
>
> *SELECT* `auto_type`.`id`, `auto_type`.`client_id`,
> `auto_type`.`category_id`,
Here is the SQL again it overlap in previous post dont know why it posted
twice:
*SELECT* `auto_type`.`id`, `auto_type`.`client_id`,
`auto_type`.`category_id`, `auto_type`.`subcategory_id`,
`auto_type`.`project_id`, `auto_type`.`title`, `auto_client`.`id`,
`auto_client`.`title`,
I am sorry I post the old one here is the update:
Screenshot:
http://cl.ly/image/2A3z1q2l053l
Screenshot of Admin clicking on TYPES = 60 seconds to load this is the query
http://cl.ly/image/1G1S0c0r302s
if I remove from admin "list_display
class ProjectAdmin(admin.ModelAdmin):
list_display
Your query clearly indicates that you're still doing foreign keys
against TITLE fields, which are strings. So something is definitely
still incorrect in your models.
Make sure that your foreign keys really point to ID field (basically
that is leaving out
26.9.2012 9:24, rentgeeen kirjoitti:
I postet the query above in the 1st post, it takes like 17secs, 1 of them
like 60 secs
SELECT `auto_type`.`id`, `auto_type`.`client_id`,
`auto_type`.`category_id`, `auto_type`.`subcategory_id`,
`auto_type`.`project_id`, `auto_type`.`title`, `auto_client`.`id`,
`auto_client`.`title`,
26.9.2012 3:08, rentgeeen kirjoitti:
I did that already, removed the field_to and make them as normal primary
keys,
the problem is when I put FK fields into "list_display" admin it still
takes SQL 60 secs to process, if I remove them all is ok and App works
great.
so weird
On Tuesday, 25
I did that already, removed the field_to and make them as normal primary
keys,
the problem is when I put FK fields into "list_display" admin it still
takes SQL 60 secs to process, if I remove them all is ok and App works
great.
so weird
On Tuesday, 25 September 2012 02:01:17 UTC-4, Jani
Actually problem exists in your model. Unless this is legacy database
that you can't do anything about.
Major performance killer is done by defining all your foreign key fields
to be _strings_. Yes. "field_to" in model.ForeignKey() means that this
field uses "field_to" in related model as a
Thanks will look at that, what I found out is if I remove foreign keys
fields from admin list display:
list_display = ('client', 'category', 'subcategory', 'project', 'title', )
to
list_display = ('title', )
its working super fast and all works.
But I want to work it out with some FK keys
I'm not an expert on this matter, but I did read about list_select
related recently:
/path/django-docs-1.4-en/ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin.list_select_related
which links to select related:
Also just found out when I remove Foreign Keys from admin.py from
"list_display", it works blazing fast:
class ClientAdmin(admin.ModelAdmin):
list_display = ('title',)
admin.site.register(Client, ClientAdmin)
class CategoryAdmin(admin.ModelAdmin):
list_display =
Have a SQL problem, adding this model all works correctly, the problem is
in ADMIN.
When I add the data just few to each table, by clicking on TYPE & PAGE in
ADMIN the page is loading so slow, installed debug_toolbar and SQL took 17
seconds for the TYPE. When I tried the PAGE it gave me
15 matches
Mail list logo