explain.depesz.com

PostgreSQL's explain analyze made readable

Result: P82

Settings
# exclusive inclusive rows x rows loops node
1. 0.011 2,401.393 ↓ 40.0 40 1

Limit (cost=545.99..546.03 rows=1 width=586) (actual time=2,401.363..2,401.393 rows=40 loops=1)

2. 0.032 2,401.382 ↓ 40.0 40 1

GroupAggregate (cost=545.99..546.03 rows=1 width=586) (actual time=2,401.362..2,401.382 rows=40 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
3. 1.914 2,401.350 ↓ 53.0 53 1

Sort (cost=545.99..546.00 rows=1 width=586) (actual time=2,401.347..2,401.350 rows=53 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: 213kB
4. 1.398 2,399.436 ↓ 1,167.0 1,167 1

Nested Loop Left Join (cost=5.00..545.98 rows=1 width=586) (actual time=0.483..2,399.436 rows=1,167 loops=1)

  • Join Filter: (cc.scopeid = ascope.scopeid)
  • 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))
5. 1.359 2,398.038 ↓ 1,167.0 1,167 1

Nested Loop Left Join (cost=4.85..544.92 rows=1 width=202) (actual time=0.468..2,398.038 rows=1,167 loops=1)

  • Join Filter: (co.contractid = ccd.contractid)
6. 0.751 2,396.679 ↓ 1,167.0 1,167 1

Nested Loop Left Join (cost=4.71..543.86 rows=1 width=202) (actual time=0.449..2,396.679 rows=1,167 loops=1)

  • Join Filter: (c.customerdivisionid = dc.customerdivisionid)
7. 0.625 2,394.761 ↓ 1,167.0 1,167 1

Nested Loop Left Join (cost=4.56..543.69 rows=1 width=202) (actual time=0.436..2,394.761 rows=1,167 loops=1)

  • Join Filter: (c.customerid = co.customerid)
8. 0.687 2,394.136 ↓ 1,167.0 1,167 1

Nested Loop Left Join (cost=4.56..532.56 rows=1 width=202) (actual time=0.431..2,394.136 rows=1,167 loops=1)

9. 0.711 2,392.282 ↓ 1,167.0 1,167 1

Nested Loop Left Join (cost=4.27..526.44 rows=1 width=146) (actual time=0.421..2,392.282 rows=1,167 loops=1)

  • Join Filter: (d.domainconfigurationid IS NULL)
10. 1.485 2,390.404 ↓ 1,167.0 1,167 1

Nested Loop Left Join (cost=3.98..526.03 rows=1 width=150) (actual time=0.409..2,390.404 rows=1,167 loops=1)

11. 0.970 2,387.752 ↓ 1,167.0 1,167 1

Nested Loop (cost=3.69..525.66 rows=1 width=90) (actual time=0.390..2,387.752 rows=1,167 loops=1)

12. 0.658 2,384.448 ↓ 1,167.0 1,167 1

Nested Loop (cost=3.40..525.35 rows=1 width=62) (actual time=0.374..2,384.448 rows=1,167 loops=1)

13. 0.785 2,381.456 ↓ 1,167.0 1,167 1

Nested Loop (cost=3.13..517.04 rows=1 width=62) (actual time=0.357..2,381.456 rows=1,167 loops=1)

14. 1.364 2,378.337 ↓ 1,167.0 1,167 1

Nested Loop Left Join (cost=2.85..508.74 rows=1 width=58) (actual time=0.341..2,378.337 rows=1,167 loops=1)

  • Filter: ((cl.linkid IS NULL) OR cl.hasminimumdata)
  • Rows Removed by Filter: 6
15. 97.893 2,375.800 ↓ 1,173.0 1,173 1

Nested Loop (cost=2.42..500.96 rows=1 width=62) (actual time=0.328..2,375.800 rows=1,173 loops=1)

16. 55.981 1,641.155 ↓ 318,376.0 318,376 1

Nested Loop (cost=1.85..500.07 rows=1 width=54) (actual time=0.109..1,641.155 rows=318,376 loops=1)

17. 78.804 498.808 ↓ 543,183.0 543,183 1

Nested Loop (cost=1.42..498.46 rows=1 width=41) (actual time=0.091..498.808 rows=543,183 loops=1)

  • Join Filter: (a.assetid = l.assetid)
18. 0.031 0.204 ↓ 8.0 8 1

Nested Loop (cost=0.85..31.47 rows=1 width=37) (actual time=0.062..0.204 rows=8 loops=1)

  • Join Filter: (a.assetid = coa.assetid)
19. 0.035 0.125 ↓ 4.0 8 1

Nested Loop (cost=0.57..30.74 rows=2 width=29) (actual time=0.046..0.125 rows=8 loops=1)

20. 0.042 0.042 ↓ 4.0 8 1

Index Scan using uq_asset_name_customerid on asset a (cost=0.28..14.12 rows=2 width=21) (actual time=0.028..0.042 rows=8 loops=1)

  • Index Cond: (customerid = 594)
  • Filter: active
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: ((assetid = a.assetid) AND (scopeid = 1))
  • Heap Fetches: 8
22. 0.048 0.048 ↑ 1.0 1 8

Index Only Scan using uq_contract_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: ((contractid = 614) AND (assetid = ascope.assetid))
  • Heap Fetches: 8
23. 419.800 419.800 ↓ 197.4 67,898 8

Index Scan using idx_link_enforcementstatus_customer_asset_minimumdata on link l (cost=0.56..462.68 rows=344 width=16) (actual time=0.020..52.475 rows=67,898 loops=8)

  • Index Cond: ((enforcementstatusid = 6) AND (customerid = 594) AND (assetid = ascope.assetid) AND (hasminimumdata = true))
  • Filter: ((NOT deleted) AND hasminimumdata)
24. 1,086.366 1,086.366 ↑ 1.0 1 543,183

Index Scan using idx_detectionlink_linkid on detectionlink dl (cost=0.43..1.61 rows=1 width=13) (actual time=0.002..0.002 rows=1 loops=543,183)

  • Index Cond: (detectionlinkid = l.linkid)
25. 636.752 636.752 ↓ 0.0 0 318,376

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.002 rows=0 loops=318,376)

  • Index Cond: ((incidentstatusid = 2) AND (customerid = 594) AND (detectionlinkid = dl.detectionlinkid))
  • Filter: ((NOT deleted) AND (enforcementlevelid = 8))
  • Rows Removed by Filter: 0
26. 1.173 1.173 ↓ 0.0 0 1,173

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

  • Index Cond: (linkid = i.contentlinkid)
  • Filter: (customerid = 594)
27. 2.334 2.334 ↑ 1.0 1 1,167

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

  • Index Cond: (contractid = 614)
  • Filter: active
28. 2.334 2.334 ↑ 1.0 1 1,167

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

  • Index Cond: (scopeid = 1)
  • Heap Fetches: 1167
29. 2.334 2.334 ↑ 1.0 1 1,167

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

  • Index Cond: (domainid = l.domainid)
  • Filter: active
30. 1.167 1.167 ↑ 1.0 1 1,167

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

  • Index Cond: (domainconfigurationid = d.domainconfigurationid)
31. 1.167 1.167 ↓ 0.0 0 1,167

Index Scan using uq_domain_domainid_domaintypeid on domain md (cost=0.29..0.40 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=1,167)

  • Index Cond: (domainid = d.masterdomainid)
  • Filter: (hierarchylevelid = 1)
32. 1.167 1.167 ↓ 0.0 0 1,167

Index Scan using pk_domainconfiguration on domainconfiguration mcfg (cost=0.29..6.12 rows=1 width=64) (actual time=0.001..0.001 rows=0 loops=1,167)

  • Index Cond: (domainconfigurationid = md.domainconfigurationid)
33. 0.000 0.000 ↓ 0.0 0 1,167

Seq Scan on customerdivision c (cost=0.00..10.50 rows=50 width=8) (actual time=0.000..0.000 rows=0 loops=1,167)

34. 1.167 1.167 ↓ 0.0 0 1,167

Index Only Scan using uq_domain_customerdivision__domain_customerdivision on domain_customerdivision dc (cost=0.14..0.16 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=1,167)

  • Index Cond: (domainid = d.domainid)
  • Heap Fetches: 0
35. 0.000 0.000 ↓ 0.0 0 1,167

Index Only Scan using uq_contract_customerdivision__contract_customerdivision on contract_customerdivision ccd (cost=0.14..1.04 rows=1 width=8) (actual time=0.000..0.000 rows=0 loops=1,167)

  • Index Cond: ((contractid = 614) AND (customerdivisionid = c.customerdivisionid))
  • Heap Fetches: 0
36. 0.000 0.000 ↓ 0.0 0 1,167

Index Only Scan using uq_customerdivisionscope_customerdivision_scope on customerdivision_scope cc (cost=0.15..1.05 rows=1 width=8) (actual time=0.000..0.000 rows=0 loops=1,167)

  • Index Cond: ((customerdivisionid = c.customerdivisionid) AND (scopeid = 1))
  • Heap Fetches: 0
Planning time : 19.905 ms
Execution time : 2,401.635 ms