explain.depesz.com

PostgreSQL's explain analyze made readable

Result: LtVN

Settings
# exclusive inclusive rows x rows loops node
1. 5.860 19,467.351 ↑ 1.0 1 1

Aggregate (cost=58,131.60..58,131.61 rows=1 width=4) (actual time=19,467.351..19,467.351 rows=1 loops=1)

2. 27.905 19,461.491 ↓ 25.4 31,621 1

Nested Loop (cost=10,319.27..58,128.49 rows=1,245 width=4) (actual time=297.593..19,461.491 rows=31,621 loops=1)

3. 11.760 302.881 ↓ 2.6 31,621 1

Merge Left Join (cost=10,318.84..10,472.32 rows=11,934 width=4) (actual time=284.285..302.881 rows=31,621 loops=1)

  • Merge Cond: (((pd.doc_format)::text = dat.doc_format) AND (pd.template_id = dat.template_id))
  • Filter: ((NOT dat.specialized) OR (pd.template_id IS NULL))
4. 43.911 291.121 ↓ 1.6 31,621 1

Sort (cost=10,269.08..10,319.00 rows=19,966 width=34) (actual time=284.275..291.121 rows=31,621 loops=1)

  • Sort Key: pd.doc_format, pd.template_id
  • Sort Method: quicksort Memory: 3239kB
5. 247.210 247.210 ↓ 1.6 31,621 1

Index Scan using idx_center_id on patient_documents pd (cost=0.44..8,842.99 rows=19,966 width=34) (actual time=0.151..247.210 rows=31,621 loops=1)

  • Index Cond: (center_id = 5)
6. 0.000 0.000 ↓ 0.0 0

Sort (cost=49.76..50.57 rows=324 width=37) (never executed)

  • Sort Key: dat.doc_format, dat.template_id
7. 0.000 0.000 ↓ 0.0 0

Subquery Scan on dat (cost=29.77..36.25 rows=324 width=37) (never executed)

8. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=29.77..33.01 rows=324 width=207) (never executed)

9. 0.000 0.000 ↓ 0.0 0

Append (cost=0.00..22.48 rows=324 width=207) (never executed)

10. 0.000 0.000 ↓ 0.0 0

Seq Scan on doc_hvf_templates (cost=0.00..1.01 rows=1 width=73) (never executed)

11. 0.000 0.000 ↓ 0.0 0

Seq Scan on doc_rich_templates (cost=0.00..2.17 rows=17 width=68) (never executed)

12. 0.000 0.000 ↓ 0.0 0

Seq Scan on doc_pdf_form_templates (cost=0.00..4.16 rows=116 width=44) (never executed)

13. 0.000 0.000 ↓ 0.0 0

Seq Scan on doc_rtf_templates (cost=0.00..11.90 rows=190 width=319) (never executed)

14. 19,130.705 19,130.705 ↑ 1.0 1 31,621

Index Scan using patient_general_docs_pkey on patient_general_docs pgd (cost=0.43..3.98 rows=1 width=6) (actual time=0.569..0.605 rows=1 loops=31,621)

  • Index Cond: (doc_id = pd.doc_id)