explain.depesz.com

PostgreSQL's explain analyze made readable

Result: snh

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Group (cost=570,865.43..570,865.64 rows=6 width=112) (actual rows= loops=)

  • Group Key: ps.name, ((psi.executiondate)::date), coc.name, psi.uid, tei.value, tei1.value, tei2.value, tei3.value, tei4.value, tei5.value, psi.storedby, ou.name
2.          

CTE psi_ids

3. 0.000 0.000 ↓ 0.0

Index Scan using programstageinstance_executiondate on programstageinstance (cost=0.43..61,135.25 rows=4,089 width=4) (actual rows= loops=)

  • Index Cond: (executiondate >= '2018-12-01 00:00:00'::timestamp without time zone)
  • Filter: ((deleted IS FALSE) AND (programstageid = ANY ('{8730837,8730976,8731010}'::integer[])))
4. 0.000 0.000 ↓ 0.0

Sort (cost=509,730.17..509,730.19 rows=6 width=112) (actual rows= loops=)

  • Sort Key: ps.name, ((psi.executiondate)::date), coc.name, psi.uid, tei.value, tei1.value, tei2.value, tei3.value, tei4.value, tei5.value, psi.storedby, ou.name
5. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1,003.48..509,730.10 rows=6 width=112) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Index Only Scan using dataelement_pkey on dataelement de (cost=0.14..2.36 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (dataelementid = 7258)
7. 0.000 0.000 ↓ 0.0

Nested Loop Semi Join (cost=1,003.34..509,727.66 rows=6 width=120) (actual rows= loops=)

  • Join Filter: (psi.programstageinstanceid = psi_ids.programstageinstanceid)
8. 0.000 0.000 ↓ 0.0

Gather (cost=1,003.34..508,674.74 rows=11 width=148) (actual rows= loops=)

  • Workers Planned: 4
9. 0.000 0.000 ↓ 0.0

Nested Loop (cost=3.34..507,673.64 rows=3 width=148) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Nested Loop (cost=3.05..507,672.69 rows=3 width=134) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Nested Loop (cost=2.76..507,671.74 rows=3 width=119) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

Nested Loop (cost=2.63..507,671.26 rows=3 width=92) (actual rows= loops=)

13. 0.000 0.000 ↓ 0.0

Nested Loop (cost=2.19..507,668.09 rows=4 width=85) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.75..507,657.33 rows=16 width=74) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.31..507,577.62 rows=126 width=67) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.87..506,903.22 rows=1,066 width=60) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.43..488,960.15 rows=28,362 width=53) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on trackedentitydatavalue tei2 (cost=0.00..457,364.28 rows=28,362 width=7) (actual rows= loops=)

  • Filter: (dataelementid = 7209)
19. 0.000 0.000 ↓ 0.0

Index Scan using programstageinstance_pkey on programstageinstance psi (cost=0.43..1.10 rows=1 width=46) (actual rows= loops=)

  • Index Cond: (programstageinstanceid = tei2.programstageinstanceid)
20. 0.000 0.000 ↓ 0.0

Index Scan using trackedentitydatavalue_pkey on trackedentitydatavalue tei3 (cost=0.44..0.62 rows=1 width=7) (actual rows= loops=)

  • Index Cond: ((programstageinstanceid = psi.programstageinstanceid) AND (dataelementid = 7210))
21. 0.000 0.000 ↓ 0.0

Index Scan using trackedentitydatavalue_pkey on trackedentitydatavalue tei4 (cost=0.44..0.62 rows=1 width=7) (actual rows= loops=)

  • Index Cond: ((programstageinstanceid = psi.programstageinstanceid) AND (dataelementid = 7211))
22. 0.000 0.000 ↓ 0.0

Index Scan using trackedentitydatavalue_pkey on trackedentitydatavalue tei5 (cost=0.44..0.62 rows=1 width=7) (actual rows= loops=)

  • Index Cond: ((programstageinstanceid = psi.programstageinstanceid) AND (dataelementid = 7212))
23. 0.000 0.000 ↓ 0.0

Index Scan using trackedentitydatavalue_pkey on trackedentitydatavalue tei (cost=0.44..0.64 rows=3 width=11) (actual rows= loops=)

  • Index Cond: ((programstageinstanceid = psi.programstageinstanceid) AND (dataelementid = 7258))
24. 0.000 0.000 ↓ 0.0

Index Scan using trackedentitydatavalue_pkey on trackedentitydatavalue tei1 (cost=0.44..0.70 rows=9 width=7) (actual rows= loops=)

  • Index Cond: ((programstageinstanceid = psi.programstageinstanceid) AND (dataelementid = 7232))
25. 0.000 0.000 ↓ 0.0

Index Scan using programstage_pkey on programstage ps (cost=0.13..0.15 rows=1 width=35) (actual rows= loops=)

  • Index Cond: (programstageid = psi.programstageid)
26. 0.000 0.000 ↓ 0.0

Index Scan using organisationunit_pkey on organisationunit ou (cost=0.29..0.31 rows=1 width=23) (actual rows= loops=)

  • Index Cond: (organisationunitid = psi.organisationunitid)
27. 0.000 0.000 ↓ 0.0

Index Scan using categoryoptioncombo_pkey on categoryoptioncombo coc (cost=0.29..0.31 rows=1 width=22) (actual rows= loops=)

  • Index Cond: (categoryoptioncomboid = psi.attributeoptioncomboid)
28. 0.000 0.000 ↓ 0.0

CTE Scan on psi_ids (cost=0.00..81.78 rows=4,089 width=4) (actual rows= loops=)