explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ZWaoC

Settings
# exclusive inclusive rows x rows loops node
1. 0.016 4,849.975 ↓ 20.0 20 1

Limit (cost=541.11..541.15 rows=1 width=586) (actual time=4,849.94..4,849.975 rows=20 loops=1)

  • Buffers: shared hit=5395475
2. 0.038 4,849.959 ↓ 21.0 21 1

GroupAggregate (cost=541.07..541.11 rows=1 width=586) (actual time=4,849.936..4,849.959 rows=21 loops=1)

  • Group Key: dl.highrisk, dl.createdat, l.linkid, d.url, (COALESCE(cfg.icon, mcfg.icon)), (COALESCE(cfg.channelid, mcfg.channelid)), a.assetid, i.incidentstatusid
  • Buffers: shared hit=5395475
3. 262.995 4,849.921 ↓ 60.0 60 1

Sort (cost=541.07..541.08 rows=1 width=586) (actual time=4,849.916..4,849.921 rows=60 loops=1)

  • Sort Key: dl.highrisk DESC, dl.createdat, l.linkid, d.url, (COALESCE(cfg.icon, mcfg.icon)), (COALESCE(cfg.channelid, mcfg.channelid)), a.assetid
  • Sort Method: quicksort Memory: 20778kB
  • Buffers: shared hit=5395475
4. 152.091 4,586.926 ↓ 125,904.0 125,904 1

Nested Loop (cost=5..541.06 rows=1 width=586) (actual time=0.301..4,586.926 rows=125,904 loops=1)

  • Filter: (((c.customerdivisionid IS NOT NULL) AND (dc.domainid IS NOT NULL) AND (cc.scopeid IS NOT NULL) AND (ccd.contractid IS NOT NULL)) OR (c.customerdivisionid IS NULL))
  • Buffers: shared hit=5395461
5. 105.930 4,434.835 ↓ 125,904.0 125,904 1

Nested Loop (cost=4.85..540.57 rows=1 width=198) (actual time=0.286..4,434.835 rows=125,904 loops=1)

  • Buffers: shared hit=5269557
6. 150.391 4,328.905 ↓ 125,904.0 125,904 1

Nested Loop (cost=4.71..539.52 rows=1 width=198) (actual time=0.27..4,328.905 rows=125,904 loops=1)

  • Buffers: shared hit=5269557
7. 45.306 4,178.514 ↓ 125,904.0 125,904 1

Nested Loop (cost=4.56..539.35 rows=1 width=198) (actual time=0.258..4,178.514 rows=125,904 loops=1)

  • Buffers: shared hit=5143653
8. 125.095 4,133.208 ↓ 125,904.0 125,904 1

Nested Loop (cost=4.56..528.22 rows=1 width=198) (actual time=0.253..4,133.208 rows=125,904 loops=1)

  • Buffers: shared hit=5143653
9. 130.483 4,008.113 ↓ 125,904.0 125,904 1

Nested Loop (cost=4.27..522.07 rows=1 width=144) (actual time=0.239..4,008.113 rows=125,904 loops=1)

  • Buffers: shared hit=5096850
10. 102.253 3,877.630 ↓ 125,904.0 125,904 1

Nested Loop (cost=3.98..521.66 rows=1 width=148) (actual time=0.224..3,877.63 rows=125,904 loops=1)

  • Buffers: shared hit=5050047
11. 138.495 3,649.473 ↓ 125,904.0 125,904 1

Nested Loop (cost=3.69..521.29 rows=1 width=90) (actual time=0.212..3,649.473 rows=125,904 loops=1)

  • Buffers: shared hit=4719138
12. 122.649 3,385.074 ↓ 125,904.0 125,904 1

Nested Loop (cost=3.4..520.98 rows=1 width=62) (actual time=0.194..3,385.074 rows=125,904 loops=1)

  • Buffers: shared hit=4341426
13. 138.427 3,136.521 ↓ 125,904.0 125,904 1

Nested Loop (cost=3.13..512.68 rows=1 width=62) (actual time=0.174..3,136.521 rows=125,904 loops=1)

  • Buffers: shared hit=3963714
14. 101.706 2,872.190 ↓ 125,904.0 125,904 1

Nested Loop (cost=2.85..504.38 rows=1 width=58) (actual time=0.157..2,872.19 rows=125,904 loops=1)

  • Filter: ((cl.linkid IS NULL) OR cl.hasminimumdata)
  • Buffers: shared hit=3586002
15. 53.985 2,644.554 ↓ 125,930.0 125,930 1

Nested Loop (cost=2.42..496.43 rows=1 width=62) (actual time=0.146..2,644.554 rows=125,930 loops=1)

  • Buffers: shared hit=3429434
16. 55.122 1,635.684 ↓ 318,295.0 318,295 1

Nested Loop (cost=1.85..495.54 rows=1 width=54) (actual time=0.104..1,635.684 rows=318,295 loops=1)

  • Buffers: shared hit=1952233
17. 81.913 494.322 ↓ 543,120.0 543,120 1

Nested Loop (cost=1.42..493.96 rows=1 width=41) (actual time=0.089..494.322 rows=543,120 loops=1)

  • Buffers: shared hit=2237
18. 0.037 0.201 ↓ 8.0 8 1

Nested Loop (cost=0.85..29.76 rows=1 width=37) (actual time=0.059..0.201 rows=8 loops=1)

  • Buffers: shared hit=52
19. 0.037 0.124 ↓ 4.0 8 1

Nested Loop (cost=0.57..29.03 rows=2 width=29) (actual time=0.044..0.124 rows=8 loops=1)

  • Buffers: shared hit=28
20. 0.031 0.031 ↓ 4.0 8 1

Index Scan using idx_asset_customer on asset a (cost=0.28..12.41 rows=2 width=21) (actual time=0.018..0.031 rows=8 loops=1)

  • Index Cond: (a.customerid = 594)
  • Filter: a.active
  • Buffers: shared hit=4
21. 0.056 0.056 ↑ 1.0 1 8

Index Only Scan using uq_asset_scope on asset_scope ascope (cost=0.29..8.31 rows=1 width=8) (actual time=0.007..0.007 rows=1 loops=8)

  • Index Cond: ((ascope.assetid = a.assetid) AND (ascope.scopeid = 1))
  • Heap Fetches: 8
  • Buffers: shared hit=24
22. 0.040 0.040 ↑ 1.0 1 8

Index Scan using idx_contract_asset__asset on contract_asset coa (cost=0.28..0.36 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=8)

  • Index Cond: (coa.assetid = ascope.assetid)
  • Filter: (coa.contractid = 614)
  • Buffers: shared hit=24
23. 412.208 412.208 ↓ 192.9 67,890 8

Index Scan using idx_link_enforcementstatus_customer_asset_minimumdata on link l (cost=0.56..459.8 rows=352 width=16) (actual time=0.02..51.526 rows=67,890 loops=8)

  • Index Cond: ((l.enforcementstatusid = 6) AND (l.customerid = 594) AND (l.assetid = ascope.assetid) AND (l.hasminimumdata = true))
  • Filter: ((NOT l.deleted) AND l.hasminimumdata)
  • Buffers: shared hit=2185
24. 1,086.240 1,086.240 ↑ 1.0 1 543,120

Index Scan using idx_detectionlink_link on detectionlink dl (cost=0.43..1.58 rows=1 width=13) (actual time=0.002..0.002 rows=1 loops=543,120)

  • Index Cond: (dl.detectionlinkid = l.linkid)
  • Buffers: shared hit=1949996
25. 954.885 954.885 ↓ 0.0 0 318,295

Index Scan using idx_incident_incidentstatus_customer_detectionlinkid on incident i (cost=0.56..0.88 rows=1 width=16) (actual time=0.002..0.003 rows=0 loops=318,295)

  • Index Cond: ((i.incidentstatusid = 12) AND (i.customerid = 594) AND (i.detectionlinkid = dl.detectionlinkid))
  • Filter: ((NOT i.deleted) AND (i.enforcementlevelid = 8))
  • Buffers: shared hit=1477201
26. 125.930 125.930 ↓ 0.0 0 125,930

Index Scan using uq_link_linkid_linktypeid on link cl (cost=0.44..7.94 rows=1 width=5) (actual time=0.001..0.001 rows=0 loops=125,930)

  • Index Cond: (cl.linkid = i.contentlinkid)
  • Filter: (cl.customerid = 594)
  • Buffers: shared hit=156568
27. 125.904 125.904 ↑ 1.0 1 125,904

Index Scan using pk_contract on contract co (cost=0.28..8.29 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=125,904)

  • Index Cond: (co.contractid = 614)
  • Filter: co.active
  • Buffers: shared hit=377712
28. 125.904 125.904 ↑ 1.0 1 125,904

Index Only Scan using pk_scope on scope scope (cost=0.28..8.29 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=125,904)

  • Index Cond: (scope.scopeid = 1)
  • Heap Fetches: 125904
  • Buffers: shared hit=377712
29. 125.904 125.904 ↑ 1.0 1 125,904

Index Scan using uq_domain_domainid_domaintypeid on domain d (cost=0.29..0.31 rows=1 width=32) (actual time=0.001..0.001 rows=1 loops=125,904)

  • Index Cond: (d.domainid = l.domainid)
  • Filter: d.active
  • Buffers: shared hit=377712
30. 125.904 125.904 ↑ 1.0 1 125,904

Index Scan using pk_domainconfiguration on domainconfiguration cfg (cost=0.29..0.37 rows=1 width=62) (actual time=0.001..0.001 rows=1 loops=125,904)

  • Index Cond: (cfg.domainconfigurationid = d.domainconfigurationid)
  • Buffers: shared hit=330909
31. 0.000 0.000 ↓ 0.0 0 125,904

Index Scan using uq_domain_domainid_domaintypeid on domain md (cost=0.29..0.4 rows=1 width=8) (actual time=0..0 rows=0 loops=125,904)

  • Index Cond: (md.domainid = d.masterdomainid)
  • Filter: (md.hierarchylevelid = 1)
  • Buffers: shared hit=46803
32. 0.000 0.000 ↓ 0.0 0 125,904

Index Scan using pk_domainconfiguration on domainconfiguration mcfg (cost=0.29..6.15 rows=1 width=62) (actual time=0..0 rows=0 loops=125,904)

  • Index Cond: (mcfg.domainconfigurationid = md.domainconfigurationid)
  • Buffers: shared hit=46803
33. 0.000 0.000 ↓ 0.0 0 125,904

Seq Scan on customerdivision c (cost=0..10.5 rows=50 width=8) (actual time=0..0 rows=0 loops=125,904)

34. 0.000 0.000 ↓ 0.0 0 125,904

Index Scan using idx_domaincustomerdivision_domain on domain_customerdivision dc (cost=0.14..0.16 rows=1 width=8) (actual time=0..0 rows=0 loops=125,904)

  • Index Cond: (d.domainid = dc.domainid)
  • Buffers: shared hit=125904
35. 0.000 0.000 ↓ 0.0 0 125,904

Index Scan using idx_contractcustomerdivision_customerdivision on contract_customerdivision ccd (cost=0.14..1.04 rows=1 width=8) (actual time=0..0 rows=0 loops=125,904)

  • Index Cond: (ccd.customerdivisionid = c.customerdivisionid)
  • Filter: (ccd.contractid = 614)
36. 0.000 0.000 ↓ 0.0 0 125,904

Index Scan using idx_customerdivisionscope_scope on customerdivision_scope cc (cost=0.15..0.36 rows=10 width=8) (actual time=0..0 rows=0 loops=125,904)

  • Index Cond: ((cc.scopeid = ascope.scopeid) AND (cc.scopeid = 1))
  • Buffers: shared hit=125904
Planning time : 24.515 ms
Execution time : 4,851.46 ms