explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Dm6j

Settings
# exclusive inclusive rows x rows loops node
1. 376.973 2,451.904 ↑ 1.0 1 1

Aggregate (cost=4,942,849.25..4,942,849.26 rows=1 width=56) (actual time=2,451.904..2,451.904 rows=1 loops=1)

2. 221.438 641.348 ↑ 1.4 293,675 1

Hash Right Join (cost=88,817.66..231,632.62 rows=400,277 width=35) (actual time=295.055..641.348 rows=293,675 loops=1)

  • Hash Cond: (j10_id.document_id = t.id)
3. 139.647 163.613 ↑ 1.0 182,432 1

Bitmap Heap Scan on invoice j10_id (cost=2,590.43..144,914.76 rows=186,906 width=25) (actual time=35.233..163.613 rows=182,432 loops=1)

  • Recheck Cond: (document_id IS NOT NULL)
  • Heap Blocks: exact=56978
4. 23.966 23.966 ↑ 1.0 182,461 1

Bitmap Index Scan on invoice_unique_in_document_id (cost=0.00..2,543.70 rows=185,476 width=0) (actual time=23.966..23.966 rows=182,461 loops=1)

5. 85.128 256.297 ↑ 1.4 293,675 1

Hash (cost=81,223.77..81,223.77 rows=400,277 width=26) (actual time=256.297..256.297 rows=293,675 loops=1)

  • Buckets: 524288 Batches: 1 Memory Usage: 20852kB
6. 171.169 171.169 ↑ 1.4 293,675 1

Seq Scan on document t (cost=0.00..81,223.77 rows=400,277 width=26) (actual time=0.011..171.169 rows=293,675 loops=1)

  • Filter: (NOT deleted)
7.          

SubPlan (for Aggregate)

8. 741.138 741.138 ↑ 2.0 1 123,523

Index Scan using field_unique_in_document on field (cost=0.56..3.89 rows=2 width=9) (actual time=0.006..0.006 rows=1 loops=123,523)

  • Index Cond: ((document_id = t.id) AND (name = 'type_document'::text))
9. 355.221 355.221 ↑ 2.0 1 118,407

Index Scan using field_unique_in_document on field field_1 (cost=0.56..3.89 rows=2 width=9) (actual time=0.003..0.003 rows=1 loops=118,407)

  • Index Cond: ((document_id = t.id) AND (name = 'type_document'::text))
10. 337.224 337.224 ↑ 2.0 1 112,408

Index Scan using field_unique_in_document on field field_2 (cost=0.56..3.89 rows=2 width=9) (actual time=0.002..0.003 rows=1 loops=112,408)

  • Index Cond: ((document_id = t.id) AND (name = 'type_document'::text))
Planning time : 0.952 ms
Execution time : 2,452.192 ms