[ I realize what I am trying to do might be a prime example of abusing the admin. The real answer to my question might very well be: 'sorry - the admin is just not made for that', and that is fine. The main reason I am asking this is to learn more myself - and most importantly to rule out other problems in my setup ]
Hello;
I have a model with ~200000 records and growing (is that "much"?). I can visit the /admin/app/model/ url in the Admin and get a listing of all the records/instances - but when I click on one of the actual instance - i.e. something /admin/app/model/12345/ the application times out (30 seconds on Heroku). The model in question is quite simple:
model A:
foreignKey( B )
foreignkey( C )
float( )
model B
foreignkey( D )
foreignkey( D )
foreignkey( E )
The relationship between A and B is 'nearly' one-to-one; i.e. there are roughly as many rows of A as there rows of B (The B model is currently not in the admin). For the other model C.D,E,.. the relationship is extremely 'many-to-few' - i.e. the database only contains a handful of C,D,E, instances. I was wondering if something like prefetching foreign keys??? brought the whole thing to its knees?
The site is actually mainly an API - and the model in question is also exposed through a Django Rest Framework (DRF) endpoint:
So - for the DRF configuration the situation is actually opposite; accessing the whole list times out (I have not done anything to configure pagination - so this might be OK?); whereas fetching one element is snappy. The admin site is password protected - but it only contains test-data and I would be happy provide login details if someone want's to take a look.
If someone can shed some light on this I would be very grateful.
Joakim