explain.depesz.com

PostgreSQL's explain analyze made readable

Result: P8pF

Settings
# exclusive inclusive rows x rows loops node
1. 393.502 50,458.255 ↓ 2.0 567,961 1

Sort (cost=12,818,005.65..12,818,700.52 rows=277,948 width=66) (actual time=50,330.115..50,458.255 rows=567,961 loops=1)

  • Sort Key: p.eventid
  • Sort Method: quicksort Memory: 105,248kB
2. 3,215.482 50,064.753 ↓ 2.0 567,961 1

HashAggregate (cost=12,790,093.48..12,792,872.96 rows=277,948 width=66) (actual time=49,730.100..50,064.753 rows=567,961 loops=1)

3. 1,178.656 46,849.271 ↓ 3.2 7,540,590 1

Hash Join (cost=143,840.72..12,749,231.40 rows=2,334,976 width=66) (actual time=1,014.442..46,849.271 rows=7,540,590 loops=1)

  • Hash Cond: (i.hostid = hg.hostid)
4. 573.308 45,657.317 ↓ 2.9 1,588,533 1

Hash Join (cost=142,380.85..12,697,076.41 rows=546,907 width=74) (actual time=1,001.099..45,657.317 rows=1,588,533 loops=1)

  • Hash Cond: (f.itemid = i.itemid)
5. 200.220 44,085.057 ↓ 2.9 1,588,533 1

Nested Loop (cost=0.85..12,543,758.28 rows=546,907 width=74) (actual time=0.380..44,085.057 rows=1,588,533 loops=1)

6. 719.801 42,748.915 ↓ 2.0 567,961 1

Index Scan using problem_3 on problem p (cost=0.42..12,354,328.63 rows=277,948 width=66) (actual time=0.375..42,748.915 rows=567,961 loops=1)

  • Index Cond: (r_eventid IS NULL)
  • Filter: ((source = 0) AND (object = 0) AND (NOT (SubPlan 1)))
  • Rows Removed by Filter: 129
7.          

SubPlan (for Index Scan)

8. 3,975.727 42,029.114 ↓ 0.0 0 567,961

HashAggregate (cost=22.08..22.50 rows=28 width=12) (actual time=0.074..0.074 rows=0 loops=567,961)

  • Filter: ((max(r.permission) < 2) OR (min(r.permission) IS NULL) OR (min(r.permission) = 0))
  • Rows Removed by Filter: 1
9. 7,480.163 38,053.387 ↓ 1.4 40 567,961

Nested Loop Left Join (cost=1.56..21.80 rows=28 width=12) (actual time=0.006..0.067 rows=40 loops=567,961)

10. 798.661 7,951.454 ↓ 1.4 13 567,961

Nested Loop (cost=1.27..16.15 rows=9 width=16) (actual time=0.005..0.014 rows=13 loops=567,961)

11. 0.000 3,975.727 ↓ 1.5 3 567,961

Nested Loop (cost=0.85..15.08 rows=2 width=8) (actual time=0.003..0.007 rows=3 loops=567,961)

12. 1,135.922 1,135.922 ↓ 1.5 3 567,961

Index Scan using functions_1 on functions f_1 (cost=0.43..6.16 rows=2 width=8) (actual time=0.001..0.002 rows=3 loops=567,961)

  • Index Cond: (p.objectid = triggerid)
13. 3,177.066 3,177.066 ↑ 1.0 1 1,588,533

Index Scan using items_pkey on items i_1 (cost=0.43..4.45 rows=1 width=16) (actual time=0.001..0.002 rows=1 loops=1,588,533)

  • Index Cond: (itemid = f_1.itemid)
14. 3,177.066 3,177.066 ↓ 1.2 5 1,588,533

Index Only Scan using hosts_groups_1 on hosts_groups hgg (cost=0.41..0.50 rows=4 width=16) (actual time=0.001..0.002 rows=5 loops=1,588,533)

  • Index Cond: (hostid = i_1.hostid)
  • Heap Fetches: 614,838
15. 22,621.770 22,621.770 ↑ 1.0 3 7,540,590

Index Scan using rights_2 on rights r (cost=0.29..0.60 rows=3 width=12) (actual time=0.001..0.003 rows=3 loops=7,540,590)

  • Index Cond: (id = hgg.groupid)
  • Filter: (groupid = ANY ('{14,990,1142}'::bigint[]))
  • Rows Removed by Filter: 9
16. 1,135.922 1,135.922 ↓ 1.5 3 567,961

Index Scan using functions_1 on functions f (cost=0.43..0.66 rows=2 width=16) (actual time=0.001..0.002 rows=3 loops=567,961)

  • Index Cond: (triggerid = p.objectid)
17. 494.600 998.952 ↓ 1.0 1,685,329 1

Hash (cost=122,208.33..122,208.33 rows=1,613,733 width=16) (actual time=998.952..998.952 rows=1,685,329 loops=1)

  • Buckets: 262,144 Batches: 1 Memory Usage: 79,000kB
18. 504.352 504.352 ↓ 1.0 1,685,329 1

Seq Scan on items i (cost=0.00..122,208.33 rows=1,613,733 width=16) (actual time=0.007..504.352 rows=1,685,329 loops=1)

19. 7.109 13.298 ↓ 1.0 48,530 1

Hash (cost=854.39..854.39 rows=48,439 width=8) (actual time=13.298..13.298 rows=48,530 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 1,896kB
20. 6.189 6.189 ↓ 1.0 48,530 1

Seq Scan on hosts_groups hg (cost=0.00..854.39 rows=48,439 width=8) (actual time=0.006..6.189 rows=48,530 loops=1)