explain.depesz.com

PostgreSQL's explain analyze made readable

Result: DetSY

Settings
# exclusive inclusive rows x rows loops node
1. 115.235 23,878.839 ↓ 24.5 32,749 1

Unique (cost=96,994,690.82..96,994,724.17 rows=1,334 width=96) (actual time=22,892.117..23,878.839 rows=32,749 loops=1)

  • Buffers: shared hit=5953887 read=111598, temp read=3456 written=3466
2. 6,996.845 23,763.604 ↓ 188.2 251,104 1

Sort (cost=96,994,690.82..96,994,694.15 rows=1,334 width=96) (actual time=22,892.115..23,763.604 rows=251,104 loops=1)

  • Sort Key: ii.registration_number, ib.num, ib.invoice_type, ii.input_date, c.tin, ib.turnover_date, ii.invoice_status, ii.last_update_date, ps.total_price_with_tax
  • Sort Method: external merge Disk: 27648kB
  • Buffers: shared hit=5953887 read=111598, temp read=3456 written=3466
3. 165.856 16,766.759 ↓ 188.2 251,104 1

Nested Loop (cost=1.29..96,994,621.57 rows=1,334 width=96) (actual time=172.139..16,766.759 rows=251,104 loops=1)

  • Buffers: shared hit=5953887 read=111598
4. 116.944 15,847.969 ↓ 188.1 250,978 1

Nested Loop (cost=0.86..96,993,897.85 rows=1,334 width=91) (actual time=171.714..15,847.969 rows=250,978 loops=1)

  • Buffers: shared hit=4960745 read=99426
5. 125.708 14,978.091 ↓ 188.1 250,978 1

Nested Loop (cost=0.43..96,993,233.68 rows=1,334 width=83) (actual time=171.539..14,978.091 rows=250,978 loops=1)

  • Buffers: shared hit=3961224 read=93670
6. 2,816.355 13,848.471 ↓ 188.1 250,978 1

Seq Scan on invoice_info ii (cost=0.00..96,982,319.37 rows=1,334 width=59) (actual time=171.297..13,848.471 rows=250,978 loops=1)

  • Filter: ((input_date >= to_date('10-12-2018'::text, 'dd.mm.yyyy'::text)) AND (input_date <= to_date('11-12-2018'::text, 'dd.mm.yyyy'::text)) AND (last_update_date = (SubPlan 1)))
  • Rows Removed by Filter: 3213754
  • Buffers: shared hit=2975780 read=73837
7.          

SubPlan (forSeq Scan)

8. 538.152 11,032.116 ↑ 1.0 1 269,076

Aggregate (cost=27.94..27.95 rows=1 width=4) (actual time=0.041..0.041 rows=1 loops=269,076)

  • Buffers: shared hit=2968893 read=17895
9. 10,493.964 10,493.964 ↓ 1.2 7 269,076

Index Scan using invoice_info_regnum_idx on invoice_info if (cost=0.56..27.93 rows=6 width=4) (actual time=0.034..0.039 rows=7 loops=269,076)

  • Index Cond: ((registration_number)::text = (ii.registration_number)::text)
  • Buffers: shared hit=2968893 read=17895
10. 1,003.912 1,003.912 ↑ 1.0 1 250,978

Index Scan using invoice_body_ii_idx on invoice_body ib (cost=0.43..8.17 rows=1 width=40) (actual time=0.003..0.004 rows=1 loops=250,978)

  • Index Cond: (invoice_info_id = ii.invoice_info_id)
  • Buffers: shared hit=985444 read=19833
11. 752.934 752.934 ↑ 1.0 1 250,978

Index Scan using product_set_ib_idx on product_set ps (cost=0.43..0.49 rows=1 width=8) (actual time=0.002..0.003 rows=1 loops=250,978)

  • Index Cond: (invoice_body_id = ib.invoice_body_id)
  • Buffers: shared hit=999521 read=5756
12. 752.934 752.934 ↑ 1.0 1 250,978

Index Scan using customers_ib_idx on customers c (cost=0.43..0.53 rows=1 width=17) (actual time=0.003..0.003 rows=1 loops=250,978)

  • Index Cond: (invoice_body_id = ps.invoice_body_id)
  • Buffers: shared hit=993142 read=12172