explain.depesz.com

PostgreSQL's explain analyze made readable

Result: G7Ch

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

Merge Join (cost=30,655.29..3,769,859.31 rows=455,029 width=165) (actual rows= loops=)

  • Merge Cond: (l.invdocid = tl.invdocid)
  • Join Filter: ((l.resultset)::text ~~* tl.resultfilter)
2.          

CTE runids

3. 0.000 0.000 ↓ 0.0

Values Scan on "*VALUES*" (cost=0.00..0.01 rows=1 width=4) (actual rows= loops=)

4.          

CTE buildinvprestemplateinit

5. 0.000 0.000 ↓ 0.0

Seq Scan on invprestemplateline (cost=0.00..504.27 rows=87,400 width=76) (actual rows= loops=)

  • Filter: active
6.          

CTE buildinvprestemplate

7. 0.000 0.000 ↓ 0.0

CTE Scan on buildinvprestemplateinit (cost=0.00..6,118.00 rows=87,400 width=236) (actual rows= loops=)

8.          

CTE discounttext

9. 0.000 0.000 ↓ 0.0

HashAggregate (cost=1,966.52..1,966.53 rows=1 width=32) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

CTE Scan on buildinvprestemplate (cost=0.00..1,966.50 rows=9 width=32) (actual rows= loops=)

  • Filter: ((text)::text ~~ '==DISCOUNT_LABELS;%'::text)
11.          

CTE rateitemtext

12. 0.000 0.000 ↓ 0.0

HashAggregate (cost=1,966.52..1,966.53 rows=1 width=32) (actual rows= loops=)

13. 0.000 0.000 ↓ 0.0

CTE Scan on buildinvprestemplate buildinvprestemplate_1 (cost=0.00..1,966.50 rows=9 width=32) (actual rows= loops=)

  • Filter: ((text)::text ~~ '==RATEITEM_LABELS;%'::text)
14.          

CTE templatelineids

15. 0.000 0.000 ↓ 0.0

Hash Join (cost=53.83..10,795.29 rows=90,896 width=464) (actual rows= loops=)

  • Hash Cond: (tl_1.invprestemplateid = p.invprestemplateid)
16. 0.000 0.000 ↓ 0.0

CTE Scan on buildinvprestemplate tl_1 (cost=0.00..1,748.00 rows=87,400 width=460) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Hash (cost=51.23..51.23 rows=208 width=12) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.71..51.23 rows=208 width=12) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.28..2.33 rows=1 width=4) (actual rows= loops=)

20. 0.000 0.000 ↓ 0.0

CTE Scan on runids ri (cost=0.00..0.02 rows=1 width=4) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Index Scan using invpresrun_invdocrunid_index on invpresrun d (cost=0.28..2.30 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (invdocrunid = ri.invdocrunid)
22. 0.000 0.000 ↓ 0.0

Index Scan using invpres_invpresrunid_index on invpres p (cost=0.43..34.45 rows=1,445 width=16) (actual rows= loops=)

  • Index Cond: (invpresrunid = d.invpresrunid)
23. 0.000 0.000 ↓ 0.0

Index Scan using invdocline_invdocid_index on invdocline l (cost=0.56..2,044,396.48 rows=40,882,344 width=65) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

Sort (cost=9,304.08..9,531.32 rows=90,896 width=108) (actual rows= loops=)

  • Sort Key: tl.invdocid
25. 0.000 0.000 ↓ 0.0

CTE Scan on templatelineids tl (cost=0.00..1,817.92 rows=90,896 width=108) (actual rows= loops=)