When trying to load e.g. https://oops.canonical.com/oops/?oopsid=OOPS-7a3f809df4b4a40c7556e42f9b60f35e which is part of an 16801 oops infestation, the page takes a very long time to load (somewhere between 15 minutes and an hour, I didn't time it properly). The SQL query it appears to be stuck on is:
oops_tools=# EXPLAIN SELECT "oops_oops"."id", "oops_oops"."oopsinfestation_id", "oops_oops"."pathname", "oops_oops"."oopsid", "oops_oops"."prefix_id", "oops_oops"."pageid", "oops_oops"."date", "oops_oops"."url", "oops_oops"."http_method", "oops_oops"."duration", "oops_oops"."referrer", "oops_oops"."user_agent", "oops_oops"."most_expensive_statement", "oops_oops"."total_time", "oops_oops"."time_is_estimate", "oops_oops"."informational", "oops_oops"."appinstance_id", "oops_oops"."is_bot", "oops_oops"."is_local_referrer", "oops_oops"."classification_id", "oops_oops"."statements_count" FROM "oops_oops" WHERE "oops_oops"."oopsinfestation_id" = 6944977 ORDER BY "oops_oops"."date" DESC LIMIT 1;
QUERY PLAN
------------------------------------------------------------------------------------------------------------
Limit (cost=0.00..2898.40 rows=1 width=322)
-> Index Scan Backward using oops_oops_date on oops_oops (cost=0.00..38522683.30 rows=13291 width=322)
Filter: (oopsinfestation_id = 6944977)
(3 rows)
Without the limit, the query appears to load quickly, but with it, it takes forever.
Appears to be http:// stackoverflow. com/questions/ 21385555/ postgresql- query-very- slow-with- limit-1 . Changing "LIMIT 1" to "LIMIT 50" returns results immediately.