explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 6oD8 : Optimization for: plan #1U1V

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.005 0.096 ↑ 1.0 1 1

Aggregate (cost=1,585.36..1,585.37 rows=1 width=96) (actual time=0.096..0.096 rows=1 loops=1)

2. 0.005 0.091 ↑ 1.2 4 1

HashAggregate (cost=1,585.21..1,585.26 rows=5 width=96) (actual time=0.090..0.091 rows=4 loops=1)

  • Group Key: "*SELECT* 1".target_amount, ((0)::numeric), (((0))::numeric)
3. 0.001 0.086 ↑ 1.2 4 1

Append (cost=21.55..1,585.18 rows=5 width=96) (actual time=0.037..0.086 rows=4 loops=1)

4. 0.007 0.037 ↑ 1.3 3 1

HashAggregate (cost=21.55..21.60 rows=4 width=96) (actual time=0.036..0.037 rows=3 loops=1)

  • Group Key: "*SELECT* 1".target_amount, ((0)::numeric), (0)
5. 0.001 0.030 ↑ 1.3 3 1

Append (cost=4.30..21.52 rows=4 width=68) (actual time=0.020..0.030 rows=3 loops=1)

6. 0.002 0.024 ↑ 1.5 2 1

Subquery Scan on *SELECT* 1 (cost=4.30..13.32 rows=3 width=39) (actual time=0.020..0.024 rows=2 loops=1)

7. 0.010 0.022 ↑ 1.5 2 1

Bitmap Heap Scan on salesman_sales_target sst (cost=4.30..13.28 rows=3 width=11) (actual time=0.018..0.022 rows=2 loops=1)

  • Recheck Cond: (salesman_id = 620)
  • Heap Blocks: exact=2
8. 0.012 0.012 ↑ 1.5 2 1

Bitmap Index Scan on salesman_idx_salesman_sales_target (cost=0.00..4.30 rows=3 width=0) (actual time=0.012..0.012 rows=2 loops=1)

  • Index Cond: (salesman_id = 620)
9. 0.000 0.005 ↑ 1.0 1 1

Subquery Scan on *SELECT* 2 (cost=8.18..8.21 rows=1 width=68) (actual time=0.005..0.005 rows=1 loops=1)

10. 0.002 0.005 ↑ 1.0 1 1

Aggregate (cost=8.18..8.19 rows=1 width=40) (actual time=0.005..0.005 rows=1 loops=1)

11. 0.003 0.003 ↓ 0.0 0 1

Index Scan using salesman_idx_invoice on invoice i (cost=0.14..8.17 rows=1 width=138) (actual time=0.003..0.003 rows=0 loops=1)

  • Index Cond: (salesman_id = 620)
  • Filter: (enabled AND (NOT is_deleted) AND ((billing_type)::text = ANY ('{SELLING,SELLING_RETURN}'::text[])) AND (date_part('month'::text, date) = date_part('month'::text, (now() - '5 days'::interval))))
12. 0.001 0.048 ↑ 1.0 1 1

Subquery Scan on *SELECT* 3 (cost=1,563.55..1,563.57 rows=1 width=96) (actual time=0.048..0.048 rows=1 loops=1)

13. 0.007 0.047 ↑ 1.0 1 1

Aggregate (cost=1,563.55..1,563.56 rows=1 width=40) (actual time=0.047..0.047 rows=1 loops=1)

14. 0.002 0.040 ↑ 1.8 4 1

Nested Loop (cost=12.19..1,563.49 rows=7 width=60) (actual time=0.027..0.040 rows=4 loops=1)

15. 0.008 0.018 ↑ 1.0 2 1

Bitmap Heap Scan on orders o (cost=11.76..1,516.92 rows=2 width=8) (actual time=0.015..0.018 rows=2 loops=1)

  • Recheck Cond: (salesman_id = 620)
  • Filter: (enabled AND (NOT is_deleted) AND (NOT cancelled) AND (date_part('month'::text, (order_date)::timestamp without time zone) = date_part('month'::text, now())))
  • Heap Blocks: exact=2
16. 0.010 0.010 ↑ 222.5 2 1

Bitmap Index Scan on salesman_idx (cost=0.00..11.76 rows=445 width=0) (actual time=0.010..0.010 rows=2 loops=1)

  • Index Cond: (salesman_id = 620)
17. 0.020 0.020 ↑ 5.0 2 2

Index Scan using order_detail_order_idx on order_detail od (cost=0.43..23.19 rows=10 width=68) (actual time=0.008..0.010 rows=2 loops=2)

  • Index Cond: (orders_id = o.id)
  • Filter: ((quantity - shipped_amount) > '0'::numeric)
Planning time : 0.668 ms
Execution time : 0.254 ms