From 9f1be0b0015e2ad08de40bf36e296040fe885a63 Mon Sep 17 00:00:00 2001 From: Klaas van Schelven Date: Mon, 27 May 2024 13:06:31 +0200 Subject: [PATCH] Document admin dead-end --- events/admin.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/events/admin.py b/events/admin.py index 27b96da..dd35492 100644 --- a/events/admin.py +++ b/events/admin.py @@ -9,6 +9,21 @@ from .models import Event @admin.register(Event) class EventAdmin(admin.ModelAdmin): + # A note on performance: when using this particular (list) admin on the playground (~150K events), I ran into the + # fact that it was unusably slow (at least more slow than 30s to render). I examined this for a while, but in the + # end the conclusion was: "this will simply never work". There's simply too much brokenness here. The admin works + # fine for the "scaffolding" case, and perhaps for things like users, projects etc, but for the "main event" + # (events) we'll have to build it ourselves. Regarding the brokenness, some thoughts/links: + # + # * arbitrary sorting is (multiple columns) is possible, which means you'll need arbitrary indexes + # * https://code.djangoproject.com/ticket/8408 + # * https://github.com/django/django/blob/9a3454f6046b/django/contrib/admin/options.py#L1816 + # no point of configuration for this one, I simply clobbered Django's code directly to turn it off + # * `actions_selection_counter = False` (possible to set as an admin option) + # * then I ran into the query itself just being super-slow (presumably caused by sorting) + + # open question: when we'll "build this ourselves", is not some of the sqlite(?) slowness surfacing in other ways? + ordering = ['-timestamp'] search_fields = ['event_id', 'debug_info']