explain.depesz.com

PostgreSQL's explain analyze made readable

Result: LHZh

Settings
# exclusive inclusive rows x rows loops node
1. 92.116 1,129.759 ↑ 1.0 4 1

GroupAggregate (cost=67,033.22..99,894.53 rows=4 width=19) (actual time=941.410..1,129.759 rows=4 loops=1)

  • Group Key: api_rulecategory.name
2. 74.049 1,037.643 ↑ 1.4 136,431 1

Nested Loop (cost=67,033.22..98,958.34 rows=187,230 width=27) (actual time=628.757..1,037.643 rows=136,431 loops=1)

  • Join Filter: (api_rule.category_id = api_rulecategory.id)
  • Rows Removed by Join Filter: 409293
3. 0.018 0.018 ↑ 1.0 4 1

Index Scan using api_rulecategory_name_key on api_rulecategory (cost=0.13..12.19 rows=4 width=15) (actual time=0.003..0.018 rows=4 loops=1)

4. 85.063 963.576 ↑ 1.4 136,431 4

Materialize (cost=67,033.09..84,886.43 rows=187,230 width=20) (actual time=152.894..240.894 rows=136,431 loops=4)

5. 131.904 878.513 ↑ 1.4 136,431 1

Hash Join (cost=67,033.09..82,852.28 rows=187,230 width=20) (actual time=611.552..878.513 rows=136,431 loops=1)

  • Hash Cond: (api_currentreport.system_uuid = k.host_id)
6. 45.489 136.225 ↓ 1.2 136,431 1

Hash Join (cost=237.28..11,809.95 rows=114,101 width=20) (actual time=1.021..136.225 rows=136,431 loops=1)

  • Hash Cond: (api_currentreport.rule_id = api_rule.id)
7. 89.819 89.971 ↓ 1.7 211,998 1

Index Only Scan using api_currentreport_account_rule_id_system_uuid_f48d4524_uniq on api_currentreport (cost=22.94..11,261.41 rows=126,862 width=20) (actual time=0.251..89.971 rows=211,998 loops=1)

  • Index Cond: (account = '729650'::text)
  • Filter: (NOT (hashed SubPlan 1))
  • Rows Removed by Filter: 31245
  • Heap Fetches: 0
8.          

SubPlan (for Index Only Scan)

9. 0.152 0.152 ↑ 1.0 351 1

Seq Scan on api_ack u2 (cost=0.00..21.50 rows=351 width=4) (actual time=0.006..0.152 rows=351 loops=1)

  • Filter: ((account)::text = '729650'::text)
  • Rows Removed by Filter: 649
10. 0.166 0.765 ↑ 1.0 1,073 1

Hash (cost=200.93..200.93 rows=1,073 width=8) (actual time=0.765..0.765 rows=1,073 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 58kB
11. 0.599 0.599 ↑ 1.0 1,073 1

Seq Scan on api_rule (cost=0.00..200.93 rows=1,073 width=8) (actual time=0.003..0.599 rows=1,073 loops=1)

  • Filter: active
  • Rows Removed by Filter: 120
12. 124.155 610.384 ↑ 1.0 534,184 1

Hash (cost=57,509.51..57,509.51 rows=534,184 width=16) (actual time=610.384..610.384 rows=534,184 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 2584kB
13. 82.281 486.229 ↑ 1.0 534,184 1

Subquery Scan on k (cost=0.42..57,509.51 rows=534,184 width=16) (actual time=0.010..486.229 rows=534,184 loops=1)

14. 243.996 403.948 ↑ 1.0 534,184 1

GroupAggregate (cost=0.42..52,167.68 rows=534,184 width=24) (actual time=0.010..403.948 rows=534,184 loops=1)

  • Group Key: api_hosttag_hosts.host_id
  • Filter: (count(*) >= 1)
15. 159.952 159.952 ↑ 1.0 534,184 1

Index Scan using api_hosttag_hosts_host_id_5f68428d on api_hosttag_hosts (cost=0.42..44,154.92 rows=534,184 width=16) (actual time=0.007..159.952 rows=534,184 loops=1)

  • Filter: (hosttag_id = ANY ('{1}'::integer[]))
Planning time : 0.811 ms
Execution time : 1,130.645 ms