explain.depesz.com

PostgreSQL's explain analyze made readable

Result: fgUw

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 6,757.647 ↑ 1.0 10 1

Limit (cost=3,088,742.17..3,119,037.86 rows=10 width=1,314) (actual time=6,757.454..6,757.647 rows=10 loops=1)

2. 0.038 6,757.645 ↑ 103.2 10 1

Result (cost=3,088,742.17..6,215,256.93 rows=1,032 width=1,314) (actual time=6,757.452..6,757.645 rows=10 loops=1)

3. 1.663 6,757.377 ↑ 103.2 10 1

Sort (cost=3,088,742.17..3,088,744.75 rows=1,032 width=1,294) (actual time=6,757.375..6,757.377 rows=10 loops=1)

  • Sort Key: ((SubPlan 3)) DESC, api_rule.rule_id
  • Sort Method: top-N heapsort Memory: 59kB
4. 0.775 6,755.714 ↑ 1.0 1,032 1

Hash Left Join (cost=266.93..3,088,719.87 rows=1,032 width=1,294) (actual time=2.964..6,755.714 rows=1,032 loops=1)

  • Hash Cond: (api_rule.impact_id = api_ruleimpact.id)
5. 0.396 3.569 ↑ 1.0 1,032 1

Hash Join (cost=264.04..298.17 rows=1,032 width=1,234) (actual time=1.924..3.569 rows=1,032 loops=1)

  • Hash Cond: (api_rule.category_id = api_rulecategory.id)
6. 1.081 3.164 ↑ 1.0 1,032 1

Hash Right Join (cost=262.95..291.50 rows=1,032 width=1,219) (actual time=1.902..3.164 rows=1,032 loops=1)

  • Hash Cond: (acks.rule_id = api_rule.id)
7. 0.204 0.204 ↑ 1.0 351 1

Seq Scan on api_ack acks (cost=0.00..27.62 rows=351 width=12) (actual time=0.006..0.204 rows=351 loops=1)

  • Filter: ((account)::text = '729650'::text)
  • Rows Removed by Filter: 899
8. 1.143 1.879 ↑ 1.0 1,032 1

Hash (cost=250.05..250.05 rows=1,032 width=1,211) (actual time=1.879..1.879 rows=1,032 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 1,263kB
9. 0.736 0.736 ↑ 1.0 1,032 1

Seq Scan on api_rule (cost=0.00..250.05 rows=1,032 width=1,211) (actual time=0.005..0.736 rows=1,032 loops=1)

  • Filter: active
  • Rows Removed by Filter: 373
10. 0.006 0.009 ↑ 1.0 4 1

Hash (cost=1.04..1.04 rows=4 width=15) (actual time=0.009..0.009 rows=4 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
11. 0.003 0.003 ↑ 1.0 4 1

Seq Scan on api_rulecategory (cost=0.00..1.04 rows=4 width=15) (actual time=0.003..0.003 rows=4 loops=1)

12. 0.019 0.026 ↑ 1.0 84 1

Hash (cost=1.84..1.84 rows=84 width=26) (actual time=0.026..0.026 rows=84 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 13kB
13. 0.007 0.007 ↑ 1.0 84 1

Seq Scan on api_ruleimpact (cost=0.00..1.84 rows=84 width=26) (actual time=0.002..0.007 rows=84 loops=1)

14.          

SubPlan (for Hash Left Join)

15. 6.192 6,751.344 ↑ 1.0 1 1,032

Aggregate (cost=2,992.64..2,992.65 rows=1 width=8) (actual time=6.542..6.542 rows=1 loops=1,032)

16. 30.688 6,745.152 ↓ 15.7 47 1,032

Nested Loop Anti Join (cost=300.65..2,992.63 rows=3 width=16) (actual time=0.794..6.536 rows=47 loops=1,032)

17. 25.692 6,665.688 ↓ 15.7 47 1,032

Nested Loop (cost=300.38..2,990.88 rows=3 width=20) (actual time=0.794..6.459 rows=47 loops=1,032)

18. 3,297.455 3,298.272 ↑ 4.9 48 1,032

Index Only Scan using api_currentreport_account_rule_id_system_uuid_f48d4524_uniq on api_currentreport v0 (cost=299.95..1,046.16 rows=234 width=20) (actual time=0.790..3.196 rows=48 loops=1,032)

  • Index Cond: ((account = '729650'::text) AND (rule_id = api_rule.id))
  • Filter: (NOT (hashed SubPlan 2))
  • Rows Removed by Filter: 10
  • Heap Fetches: 33,568
19.          

SubPlan (for Index Only Scan)

20. 0.201 0.817 ↑ 1.1 655 1

HashAggregate (cost=290.35..297.59 rows=724 width=4) (actual time=0.756..0.817 rows=655 loops=1)

  • Group Key: api_rule_1.id
21. 0.058 0.616 ↑ 1.0 724 1

Append (cost=0.00..288.54 rows=724 width=4) (actual time=0.003..0.616 rows=724 loops=1)

22. 0.391 0.391 ↑ 1.0 373 1

Seq Scan on api_rule api_rule_1 (cost=0.00..250.05 rows=373 width=4) (actual time=0.002..0.391 rows=373 loops=1)

  • Filter: (NOT active)
  • Rows Removed by Filter: 1,032
23. 0.167 0.167 ↑ 1.0 351 1

Seq Scan on api_ack (cost=0.00..27.62 rows=351 width=4) (actual time=0.003..0.167 rows=351 loops=1)

  • Filter: ((branch_id IS NULL) AND ((account)::text = '729650'::text))
  • Rows Removed by Filter: 899
24. 3,341.724 3,341.724 ↑ 1.0 1 49,143

Index Scan using hosts_v1_1_pkey on hosts_v1_1 (cost=0.42..8.31 rows=1 width=16) (actual time=0.068..0.068 rows=1 loops=49,143)

  • Index Cond: (id = v0.system_uuid)
  • Filter: (((account)::text = '729650'::text) AND ((stale_timestamp + '7 days'::interval) > '2020-10-11 20:14:34.279256+00'::timestamp with time zone))
  • Rows Removed by Filter: 0
25. 48.776 48.776 ↓ 0.0 0 48,776

Index Only Scan using api_hostack_rule_id_account_system_uuid_uindex on api_hostack u0_1 (cost=0.28..0.51 rows=1 width=20) (actual time=0.001..0.001 rows=0 loops=48,776)

  • Index Cond: ((rule_id = v0.rule_id) AND (rule_id = api_rule.id) AND (account = '729650'::text) AND (system_uuid = v0.system_uuid))
  • Heap Fetches: 0
26.          

SubPlan (for Result)

27. 0.010 0.080 ↑ 1.0 1 10

GroupAggregate (cost=0.55..16.61 rows=1 width=12) (actual time=0.008..0.008 rows=1 loops=10)

  • Group Key: u1.rule_id
28. 0.010 0.070 ↑ 1.0 1 10

Nested Loop (cost=0.55..16.60 rows=1 width=8) (actual time=0.007..0.007 rows=1 loops=10)

29. 0.040 0.040 ↑ 1.0 1 10

Index Scan using api_resolution_rule_id_43e25d91 on api_resolution u1 (cost=0.28..8.29 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=10)

  • Index Cond: (rule_id = api_rule.id)
30. 0.020 0.020 ↑ 1.0 1 10

Index Scan using api_playbook_resolution_id_ce9879e0 on api_playbook u0 (cost=0.28..8.29 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=10)

  • Index Cond: (resolution_id = u1.id)
31. 0.000 0.030 ↑ 1.0 1 10

Aggregate (cost=16.75..16.76 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=10)

32. 0.000 0.030 ↓ 0.0 0 10

Nested Loop (cost=0.70..16.75 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=10)

33. 0.030 0.030 ↓ 0.0 0 10

Index Scan using api_hostack_rule_id_account_system_uuid_uindex on api_hostack v0_1 (cost=0.28..8.30 rows=1 width=20) (actual time=0.003..0.003 rows=0 loops=10)

  • Index Cond: ((rule_id = api_rule.id) AND ((account)::text = '729650'::text))
34. 0.000 0.000 ↓ 0.0 0

Index Scan using hosts_v1_1_pkey on hosts_v1_1 hosts_v1_1_1 (cost=0.42..8.45 rows=1 width=16) (never executed)

  • Index Cond: (id = v0_1.system_uuid)
  • Filter: (((account)::text = '729650'::text) AND ((stale_timestamp + '7 days'::interval) > '2020-10-11 20:14:34.287999+00'::timestamp with time zone))
35. 0.120 0.120 ↓ 0.0 0 10

Seq Scan on api_rulerating u0_2 (cost=0.00..3.53 rows=1 width=2) (actual time=0.012..0.012 rows=0 loops=10)

  • Filter: (((rated_by)::text = 'rhn-support-dkuc'::text) AND (rule_id = api_rule.id))
  • Rows Removed by Filter: 102
Planning time : 3.216 ms
Execution time : 6,758.023 ms