explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 32Mp

Settings
# exclusive inclusive rows x rows loops node
1. 0.005 3.412 ↑ 5.0 1 1

Sort (cost=488,114.63..488,114.64 rows=5 width=39) (actual time=3.412..3.412 rows=1 loops=1)

  • Sort Key: items.invoice_description
  • Sort Method: quicksort Memory: 25kB
2. 0.184 3.407 ↑ 5.0 1 1

HashAggregate (cost=488,114.46..488,114.57 rows=5 width=39) (actual time=3.406..3.407 rows=1 loops=1)

  • Group Key: items.invoice_description, details.att_value, items.sr_vat_type, vat.vat_percentage
  • Filter: ((sum(items.sr_amount) > 0::numeric) OR (sum(items.sr_amount) < 0::numeric))
3. 0.505 3.223 ↓ 1.4 380 1

Nested Loop (cost=1.29..488,109.71 rows=271 width=39) (actual time=0.040..3.223 rows=380 loops=1)

  • Join Filter: ((items.sr_vat_type)::text = (vat.code)::text)
  • Rows Removed by Join Filter: 2,660
4. 0.069 2.718 ↓ 1.4 380 1

Nested Loop (cost=1.29..488,076.09 rows=271 width=31) (actual time=0.032..2.718 rows=380 loops=1)

5. 0.008 0.008 ↑ 1.0 1 1

Index Only Scan using stt_ibs_obs_statement_pkey on stt_ibs_obs_statement statement (cost=0.28..2.50 rows=1 width=8) (actual time=0.008..0.008 rows=1 loops=1)

  • Index Cond: (id = 177,593,827)
  • Heap Fetches: 1
6. 0.249 2.641 ↓ 1.4 380 1

Nested Loop (cost=1.01..488,070.89 rows=271 width=39) (actual time=0.023..2.641 rows=380 loops=1)

7. 0.156 0.156 ↑ 5.9 559 1

Index Scan using stt_obs_statement_items_statement_id_idx on stt_obs_statement_items items (cost=0.43..3,611.51 rows=3,296 width=38) (actual time=0.012..0.156 rows=559 loops=1)

  • Index Cond: (statement_id = 177,593,827)
8. 2.236 2.236 ↑ 3.0 1 559

Index Scan using stt_obs_statement_items_detail_item_id_idx on stt_obs_statement_item_detail details (cost=0.57..146.95 rows=3 width=17) (actual time=0.003..0.004 rows=1 loops=559)

  • Index Cond: (obs_statement_item_id = items.id)
  • Filter: (((att_name)::text = 'city'::text) AND ((att_value)::text = 'Milano'::text))
  • Rows Removed by Filter: 8
9. 0.000 0.000 ↑ 1.0 8 380

Materialize (cost=0.00..1.12 rows=8 width=11) (actual time=0.000..0.000 rows=8 loops=380)

10. 0.006 0.006 ↑ 1.0 8 1

Seq Scan on act_vat_setup vat (cost=0.00..1.08 rows=8 width=11) (actual time=0.002..0.006 rows=8 loops=1)

Planning time : 0.415 ms
Execution time : 3.495 ms