explain.depesz.com

PostgreSQL's explain analyze made readable

Result: lCWZ

Settings
# exclusive inclusive rows x rows loops node
1. 0.016 5,354.802 ↓ 20.0 20 1

Limit (cost=541.11..541.15 rows=1 width=586) (actual time=5,354.768..5,354.802 rows=20 loops=1)

  • Buffers: shared hit=5395461
2. 0.038 5,354.786 ↓ 21.0 21 1

GroupAggregate (cost=541.07..541.11 rows=1 width=586) (actual time=5,354.764..5,354.786 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=5395461
3. 267.736 5,354.748 ↓ 60.0 60 1

Sort (cost=541.07..541.08 rows=1 width=586) (actual time=5,354.742..5,354.748 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=5395461
4. 167.614 5,087.012 ↓ 125,904.0 125,904 1

Nested Loop (cost=5..541.06 rows=1 width=586) (actual time=0.248..5,087.012 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. 116.135 4,919.398 ↓ 125,904.0 125,904 1

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

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

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

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

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

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

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

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

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

  • Buffers: shared hit=5096850
10. 121.357 4,308.119 ↓ 125,904.0 125,904 1

Nested Loop (cost=3.98..521.66 rows=1 width=148) (actual time=0.186..4,308.119 rows=125,904 loops=1)

  • Buffers: shared hit=5050047
11. 171.920 4,060.858 ↓ 125,904.0 125,904 1

Nested Loop (cost=3.69..521.29 rows=1 width=90) (actual time=0.178..4,060.858 rows=125,904 loops=1)

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

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

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

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

  • Buffers: shared hit=3963714
14. 114.440 3,192.172 ↓ 125,904.0 125,904 1

Nested Loop (cost=2.85..504.38 rows=1 width=58) (actual time=0.136..3,192.172 rows=125,904 loops=1)

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

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

  • Buffers: shared hit=3429434
16. 195.016 1,824.023 ↓ 318,295.0 318,295 1

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

  • Buffers: shared hit=1952233
17. 94.594 542.767 ↓ 543,120.0 543,120 1

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

  • Buffers: shared hit=2237
18. 0.034 0.197 ↓ 8.0 8 1

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

  • Buffers: shared hit=52
19. 0.033 0.115 ↓ 4.0 8 1

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

  • Buffers: shared hit=28
20. 0.034 0.034 ↓ 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.019..0.034 rows=8 loops=1)

  • Index Cond: (a.customerid = 594)
  • Filter: a.active
  • Buffers: shared hit=4
21. 0.048 0.048 ↑ 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.006..0.006 rows=1 loops=8)

  • Index Cond: ((ascope.assetid = a.assetid) AND (ascope.scopeid = 1))
  • Heap Fetches: 8
  • Buffers: shared hit=24
22. 0.048 0.048 ↑ 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.006..0.006 rows=1 loops=8)

  • Index Cond: (coa.assetid = ascope.assetid)
  • Filter: (coa.contractid = 614)
  • Buffers: shared hit=24
23. 447.976 447.976 ↓ 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.021..55.997 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.003..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. 251.808 251.808 ↑ 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.002 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 : 22.012 ms
Execution time : 5,356.087 ms