explain.depesz.com

PostgreSQL's explain analyze made readable

Result: PWxe

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

Aggregate (cost=2,036,583.90..2,036,583.91 rows=1 width=15) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Append (cost=0.13..2,036,583.88 rows=4 width=15) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 1 (cost=0.13..2.56 rows=1 width=18) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Index Scan using idx_invoicedoc_planpos on invoicedoc (cost=0.13..2.55 rows=1 width=18) (actual rows= loops=)

  • Index Cond: ((planpositionnumber)::text = '2018035530003810010000010001'::text)
  • Filter: ((document_id <> '606412'::numeric) AND (dispstatus_id = ANY ('{4,5,10,16,17,25,32,35}'::numeric[])))
5. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 2 (cost=0.29..4.38 rows=1 width=7) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Index Scan using idx_requestdoc_planpos on requestdoc rd (cost=0.29..4.37 rows=1 width=7) (actual rows= loops=)

  • Index Cond: ((planpositionnumber)::text = '2018035530003810010000010001'::text)
  • Filter: ((document_id <> '606412'::numeric) AND (dispstatus_id = ANY ('{2,3,4,10,13,17,18,19,28,31,33,59}'::numeric[])) AND ((dispstatus_id <> '10'::numeric) OR (NOT (alternatives: SubPlan 1 or hashed SubPlan 2))))
7.          

SubPlan (forIndex Scan)

8. 0.000 0.000 ↓ 0.0

Index Only Scan using idx_document_pdd on document rdc (cost=0.42..1.65 rows=1 width=0) (actual rows= loops=)

  • Index Cond: ((parent_id = rd.document_id) AND (documentclass_id = '8'::numeric))
  • Filter: (dispstatus_id <> ALL ('{0,1,-1}'::numeric[]))
9. 0.000 0.000 ↓ 0.0

Index Only Scan using idx_document_pdd on document rdc_1 (cost=0.42..7,538.67 rows=56,065 width=6) (actual rows= loops=)

  • Index Cond: (documentclass_id = '8'::numeric)
  • Filter: (dispstatus_id <> ALL ('{0,1,-1}'::numeric[]))
10. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 3 (cost=388.06..2,035,679.90 rows=1 width=18) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=388.06..2,035,679.89 rows=1 width=16) (actual rows= loops=)

  • Join Filter: (scd.document_id = get_parent_no_class(cd.document_id))
  • Filter: (scd.id IS NULL)
12. 0.000 0.000 ↓ 0.0

Nested Loop Anti Join (cost=0.84..1,195.18 rows=244 width=22) (actual rows= loops=)

13. 0.000 0.000 ↓ 0.0

Index Scan using idx_contractdoc_planpos on contractdoc cd (cost=0.42..575.66 rows=399 width=22) (actual rows= loops=)

  • Index Cond: ((planpositionnumber)::text = '2018035530003810010000010001'::text)
  • Filter: ((document_id <> '606412'::numeric) AND (documentclass_id = '8'::numeric) AND (dispstatus_id <> ALL ('{0,1,-1}'::numeric[])))
14. 0.000 0.000 ↓ 0.0

Index Only Scan using idx_document_pdd on document cd2 (cost=0.42..1.57 rows=1 width=6) (actual rows= loops=)

  • Index Cond: ((parent_id = cd.document_id) AND (documentclass_id = '8'::numeric))
  • Filter: (dispstatus_id <> ALL ('{0,1,-1}'::numeric[]))
15. 0.000 0.000 ↓ 0.0

Materialize (cost=387.22..18,851.80 rows=31,174 width=12) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on contractdoc scd (cost=387.22..18,695.93 rows=31,174 width=12) (actual rows= loops=)

  • Recheck Cond: (documentclass_id = '32'::numeric)
17. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_contractdoc_dispstatus (cost=0.00..379.42 rows=31,174 width=0) (actual rows= loops=)

  • Index Cond: (documentclass_id = '32'::numeric)
18. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 4 (cost=897.01..897.04 rows=1 width=18) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

HashAggregate (cost=897.01..897.03 rows=1 width=33) (actual rows= loops=)

  • Group Key: scd_1.id, scd_1.document_id, scd_1.documentclass_id, CASE WHEN (scd_1.dispstatus_id = ANY ('{8,27,10}'::numeric[])) THEN scd_1.payedamount ELSE scd_1.amount END
20. 0.000 0.000 ↓ 0.0

Nested Loop Anti Join (cost=1.27..897.00 rows=1 width=33) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.84..894.20 rows=1 width=33) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

Index Scan using idx_contractdoc_planpos on contractdoc scd_1 (cost=0.42..575.66 rows=199 width=33) (actual rows= loops=)

  • Index Cond: ((planpositionnumber)::text = '2018035530003810010000010001'::text)
  • Filter: ((document_id <> '606412'::numeric) AND (documentclass_id = '32'::numeric) AND (dispstatus_id <> ALL ('{0,1,-1}'::numeric[])))
23. 0.000 0.000 ↓ 0.0

Index Only Scan using uq_docflag_doc_flagtype on docflag df (cost=0.42..1.59 rows=1 width=6) (actual rows= loops=)

  • Index Cond: ((document_id = scd_1.document_id) AND (docflagtype_id = '89'::numeric))
24. 0.000 0.000 ↓ 0.0

Index Only Scan using idx_document_pdd on document scd2 (cost=0.42..1.61 rows=1 width=6) (actual rows= loops=)

  • Index Cond: ((parent_id = scd_1.document_id) AND (documentclass_id = '32'::numeric))
  • Filter: (dispstatus_id <> ALL ('{0,1,-1}'::numeric[]))