explain.depesz.com

PostgreSQL's explain analyze made readable

Result: TOM7 : Optimization for: plan #csMS

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Unique (cost=4,364,877.06..4,364,878.56 rows=200 width=22) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Sort (cost=4,364,877.06..4,364,877.56 rows=200 width=22) (actual rows= loops=)

  • Sort Key: xref.cust_id, (min(pos.invoice_date))
3. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=4,362,887.74..4,364,869.42 rows=200 width=22) (actual rows= loops=)

  • Group Key: xref.cust_id
4. 0.000 0.000 ↓ 0.0

Unique (cost=4,362,887.74..4,363,679.61 rows=79,187 width=54) (actual rows= loops=)

5.          

Initplan (forUnique)

6. 0.000 0.000 ↓ 0.0

Seq Scan on weekly_report_parameter (cost=0.00..23.60 rows=1,360 width=4) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Sort (cost=4,362,864.14..4,363,062.11 rows=79,187 width=54) (actual rows= loops=)

  • Sort Key: xref.cust_id, pos.invoice_date, (sum(item.quantity))
8. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=4,354,243.46..4,356,421.10 rows=79,187 width=54) (actual rows= loops=)

  • Group Key: xref.cust_id, pos.invoice_date
  • Filter: (sum(item.quantity) > '0'::numeric)
9. 0.000 0.000 ↓ 0.0

Sort (cost=4,354,243.46..4,354,441.43 rows=79,187 width=27) (actual rows= loops=)

  • Sort Key: xref.cust_id, pos.invoice_date
10. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1,480,649.06..4,347,800.42 rows=79,187 width=27) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Hash Join (cost=1,480,640.51..3,483,704.78 rows=46,463 width=41) (actual rows= loops=)

  • Hash Cond: ((pos.card_no)::text = (xref.card_no)::text)
12. 0.000 0.000 ↓ 0.0

Index Scan using idx_inv_dt_t_pos_invoice on t_pos_invoice pos (cost=38.03..1,950,777.21 rows=13,747,646 width=39) (actual rows= loops=)

  • Index Cond: (invoice_date <= $0)