explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1wh3

Settings
# exclusive inclusive rows x rows loops node
1. 0.005 8,433.224 ↑ 1.0 25 1

Limit (cost=6,065.31..6,065.38 rows=25 width=238) (actual time=8,433.216..8,433.224 rows=25 loops=1)

2. 27.722 8,433.219 ↑ 7.8 25 1

Sort (cost=6,065.31..6,065.80 rows=194 width=238) (actual time=8,433.215..8,433.219 rows=25 loops=1)

  • Sort Key: gh.header_number DESC
  • Sort Method: top-N heapsort Memory: 38kB
3. 0.000 8,405.497 ↓ 349.1 67,730 1

Nested Loop Left Join (cost=5.41..6,059.84 rows=194 width=238) (actual time=0.176..8,405.497 rows=67,730 loops=1)

4. 68.013 8,207.230 ↓ 349.1 67,730 1

Nested Loop (cost=3.07..5,594.72 rows=194 width=234) (actual time=0.166..8,207.230 rows=67,730 loops=1)

5. 46.353 146.773 ↓ 371.2 72,004 1

Nested Loop (cost=0.43..1,013.90 rows=194 width=142) (actual time=0.031..146.773 rows=72,004 loops=1)

  • Join Filter: (gh.gl_book_id = gb.id)
  • Rows Removed by Join Filter: 144001
6. 100.420 100.420 ↓ 186.1 72,004 1

Index Scan using idx_gl_headers_cid_gl_transaction_type_id_post_month_reference_ on gl_headers gh (cost=0.43..962.48 rows=387 width=134) (actual time=0.022..100.420 rows=72,004 loops=1)

  • Index Cond: ((cid = 2603) AND (gl_transaction_type_id = 1) AND (reference_id IS NULL))
  • Filter: ((is_template IS FALSE) AND (gl_header_status_type_id = ANY ('{5,2,1,3}'::integer[])))
  • Rows Removed by Filter: 2811
7. 0.000 0.000 ↑ 1.3 3 72,004

Materialize (cost=0.00..1.28 rows=4 width=16) (actual time=0.000..0.000 rows=3 loops=72,004)

8. 0.006 0.006 ↑ 1.3 3 1

Seq Scan on gl_books gb (cost=0.00..1.26 rows=4 width=16) (actual time=0.005..0.006 rows=3 loops=1)

  • Filter: (cid = 2603)
  • Rows Removed by Filter: 3
9. 648.036 7,992.444 ↑ 1.0 1 72,004

GroupAggregate (cost=2.64..23.55 rows=1 width=105) (actual time=0.111..0.111 rows=1 loops=72,004)

  • Group Key: gh.cid, gh.id
  • Filter: (sum(CASE WHEN (gd.amount > '0'::numeric) THEN gd.amount ELSE '0'::numeric END) IS NOT NULL)
10. 3,024.168 7,344.408 ↓ 13.0 13 72,004

Hash Join (cost=2.64..23.49 rows=1 width=46) (actual time=0.057..0.102 rows=13 loops=72,004)

  • Hash Cond: (p.id = gd.property_id)
11. 3,384.188 3,384.188 ↑ 1.0 464 72,004

Seq Scan on lp p (cost=0.00..19.08 rows=464 width=33) (actual time=0.002..0.047 rows=464 loops=72,004)

  • Filter: (cid = 2603)
12. 144.008 936.052 ↓ 15.0 15 72,004

Hash (cost=2.61..2.61 rows=1 width=21) (actual time=0.013..0.013 rows=15 loops=72,004)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
13. 792.044 792.044 ↓ 15.0 15 72,004

Index Scan using idx_gl_details_cid_gl_transaction_type_id_post_month_gl_header_ on gl_details gd (cost=0.56..2.61 rows=1 width=21) (actual time=0.005..0.011 rows=15 loops=72,004)

  • Index Cond: ((cid = 2603) AND (gl_transaction_type_id = gh.gl_transaction_type_id) AND (post_month = gh.post_month) AND (gh.id = gl_header_id))
14. 67.730 203.190 ↓ 0.0 0 67,730

Limit (cost=2.33..2.34 rows=1 width=8) (actual time=0.003..0.003 rows=0 loops=67,730)

15. 67.730 135.460 ↓ 0.0 0 67,730

Sort (cost=2.33..2.34 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=67,730)

  • Sort Key: fa.id DESC
  • Sort Method: quicksort Memory: 25kB
16. 67.730 67.730 ↓ 0.0 0 67,730

Index Scan using idx_file_associations_gl_header_id_partial on file_associations fa (cost=0.28..2.32 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=67,730)

  • Index Cond: ((gh.cid = cid) AND (gh.id = gl_header_id))
  • Filter: (deleted_by IS NULL)
Planning time : 3.281 ms
Execution time : 8,433.342 ms