Skip to content

Instantly share code, notes, and snippets.

Created March 16, 2017 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2fb3ea55731875df7f8599f0b41dba08 to your computer and use it in GitHub Desktop.
Save anonymous/2fb3ea55731875df7f8599f0b41dba08 to your computer and use it in GitHub Desktop.
Delete on minion_jobs j (cost=0.00..16706220.40 rows=8 width=12) (actual time=610.699..610.699 rows=0 loops=1)
-> Nested Loop Anti Join (cost=0.00..16706220.40 rows=8 width=12) (actual time=610.695..610.695 rows=0 loops=1)
Join Filter: (j.id = ANY (minion_jobs.parents))
-> Seq Scan on minion_jobs j (cost=0.00..96765.88 rows=8409 width=14) (actual time=610.693..610.693 rows=0 loops=1)
Filter: ((state = 'finished'::minion_state) AND (finished <= (now() - '48:00:00'::interval)))
Rows Removed by Filter: 467049
-> Materialize (cost=0.00..94365.01 rows=84242 width=37) (never executed)
-> Seq Scan on minion_jobs (cost=0.00..93284.80 rows=84242 width=37) (never executed)
Filter: (state <> 'finished'::minion_state)
Planning time: 0.260 ms
Execution time: 610.752 ms
Delete on minion_jobs (cost=232150.86..19188272.93 rows=116036 width=38) (actual time=691.907..691.907 rows=0 loops=1)
CTE old
-> Seq Scan on minion_jobs minion_jobs_1 (cost=0.00..96765.88 rows=8416 width=8) (actual time=691.896..691.896 rows=0 loops=1)
Filter: ((state = 'finished'::minion_state) AND (finished <= (now() - '48:00:00'::interval)))
Rows Removed by Filter: 467049
CTE unfinished
-> Seq Scan on minion_jobs minion_jobs_2 (cost=0.00..135195.20 rows=8424200 width=8) (never executed)
Filter: (state <> 'finished'::minion_state)
-> Nested Loop (cost=189.78..18956311.86 rows=116036 width=38) (actual time=691.903..691.903 rows=0 loops=1)
-> HashAggregate (cost=189.36..191.36 rows=200 width=40) (actual time=691.902..691.902 rows=0 loops=1)
Group Key: old.id
-> CTE Scan on old (cost=0.00..168.32 rows=8416 width=40) (actual time=691.898..691.898 rows=0 loops=1)
-> Index Scan using minion_jobs_pkey on minion_jobs (cost=0.42..94780.59 rows=1 width=14) (never executed)
Index Cond: (id = old.id)
Filter: (NOT (SubPlan 3))
SubPlan 3
-> CTE Scan on unfinished (cost=0.00..168484.00 rows=8424200 width=8) (never executed)
Planning time: 0.386 ms
Execution time: 692.015 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment