Why is the status page so slow? It's doing two queries, one or both of them must suck. I would guess it's the reports query, since that table is much bigger.
is the reports query.
jobs.c.completeddatetime == None
is the jobs query. is that reports query screwing us by not having a date limit? I would think 'limit 1' would be good.
explain select date_processed from reports order by date_processed desc limit 1;
Limit (cost=2655.91..2655.91 rows=1 width=8)
-> Sort (cost=2655.91..2667.54 rows=4652 width=8)
Sort Key: public.reports.date_processed
-> Result (cost=0.00..2372.52 rows=4652 width=8)
-> Append (cost=0.00..2372.52 rows=4652 width=8)
-> Seq Scan on reports (cost=0.00..10.20 rows=20 width=8)
-> Seq Scan on reports_part1 reports (cost=0.00..2362.32 rows=4632 width=8)
Yeah, that's bad. We don't have an index on date_procesed. Can we just get this from the jobs table instead? Or store it somewhere else?
Created attachment 314843 [details] [diff] [review]
use jobs instead
This is approximately a million billion times better. Ok, it's still doing a seq scan on jobs, but that table is much smaller than reports. We could toss an index on here to make it better, but that's of questionable merit. Adding an index to reports to fix this problem just seems silly.
Comment on attachment 314843 [details] [diff] [review]
use jobs instead
Could we add # of items in the queue, # of threads and oldest item in queue?
# items in queue is already on that page. I'll make it grab the other info.
Created attachment 314915 [details] [diff] [review]
with more stuffs
Yeah, I didn't add # of processors because we don't have that table defined yet in the SQLAlchemy model, and I just don't feel like adding it. This adds OldestQueuedJob, AverageProcessTime (process end time - process start time), and AverageWaitTime (process end time - queue time).