explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Se3R : Optimization for: Optimization for: plan #YItN; plan #OSY9

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 165.171 1,878.154 ↓ 1.1 28,477 1

Sort (cost=811,840.24..811,902.22 rows=24,789 width=1,533) (actual time=1,853.662..1,878.154 rows=28,477 loops=1)

  • Sort Key: c_order.created DESC
  • Sort Method: external merge Disk: 14528kB
  • Buffers: shared hit=670361, temp read=3936 written=3936
2.          

Initplan (for Sort)

3. 0.001 0.001 ↑ 1.0 1 1

Result (cost=0.00..0.01 rows=1 width=32) (actual time=0.001..0.001 rows=1 loops=1)

4. 744.762 1,712.982 ↓ 1.1 28,477 1

Seq Scan on c_order (cost=7.16..790,674.86 rows=24,789 width=1,533) (actual time=0.448..1,712.982 rows=28,477 loops=1)

  • Filter: ((ad_client_id = ANY ('{0,2000006}'::numeric[])) AND ((c_order_id IS NULL) OR (NOT (hashed SubPlan 7))) AND (issotrx = 'Y'::bpchar) AND ((processed = 'N'::bpchar) OR (updated > (now() - '1'::numeric))))
  • Rows Removed by Filter: 68017
  • Buffers: shared hit=670358
5.          

SubPlan (for Seq Scan)

6. 170.862 170.862 ↓ 0.0 0 28,477

Index Scan using c_bpartner_pkey on c_bpartner (cost=0.41..2.64 rows=1 width=32) (actual time=0.006..0.006 rows=0 loops=28,477)

  • Index Cond: (c_bpartner_id = c_order.c_bpartner_id)
  • Filter: (created > (('now'::cstring)::date - '2 mons'::interval))
  • Rows Removed by Filter: 1
  • Buffers: shared hit=115187
7. 170.862 170.862 ↑ 1.0 1 28,477

Index Scan using c_order_pkey on c_order co (cost=0.29..2.52 rows=1 width=32) (actual time=0.005..0.006 rows=1 loops=28,477)

  • Index Cond: (c_order_id = c_order.c_order_id)
  • Buffers: shared hit=85581
8. 28.477 284.770 ↑ 1.0 1 28,477

Aggregate (cost=16.68..16.69 rows=1 width=8) (actual time=0.010..0.010 rows=1 loops=28,477)

  • Buffers: shared hit=154713
9. 56.929 256.293 ↓ 0.0 0 28,477

Hash Semi Join (cost=13.92..16.68 rows=1 width=0) (actual time=0.009..0.009 rows=0 loops=28,477)

  • Hash Cond: (c_orderline.m_product_id = (max(m_product.m_product_id)))
  • Buffers: shared hit=154713
10. 199.339 199.339 ↑ 1.4 5 28,477

Index Scan using c_orderline_order on c_orderline (cost=0.42..3.16 rows=7 width=6) (actual time=0.005..0.007 rows=5 loops=28,477)

  • Index Cond: (c_order_id = c_order.c_order_id)
  • Buffers: shared hit=154711
11. 0.009 0.025 ↑ 1.0 1 1

Hash (cost=13.49..13.49 rows=1 width=32) (actual time=0.025..0.025 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=2
12. 0.007 0.016 ↑ 1.0 1 1

Aggregate (cost=13.47..13.48 rows=1 width=32) (actual time=0.016..0.016 rows=1 loops=1)

  • Buffers: shared hit=2
13. 0.009 0.009 ↑ 11.0 1 1

Index Scan using m_product_lower_description_not on m_product (cost=0.12..13.44 rows=11 width=6) (actual time=0.009..0.009 rows=1 loops=1)

  • Buffers: shared hit=2
14. 0.000 170.862 ↑ 1.0 1 28,477

Aggregate (cost=5.56..5.57 rows=1 width=8) (actual time=0.006..0.006 rows=1 loops=28,477)

  • Buffers: shared hit=154713
15. 56.935 170.862 ↓ 0.0 0 28,477

Hash Semi Join (cost=2.80..5.55 rows=1 width=0) (actual time=0.006..0.006 rows=0 loops=28,477)

  • Hash Cond: (c_orderline_1.m_product_id = (max(m_product_1.m_product_id)))
  • Buffers: shared hit=154713
16. 113.908 113.908 ↑ 1.4 5 28,477

Index Scan using c_orderline_order on c_orderline c_orderline_1 (cost=0.42..3.16 rows=7 width=6) (actual time=0.003..0.004 rows=5 loops=28,477)

  • Index Cond: (c_order_id = c_order.c_order_id)
  • Buffers: shared hit=154711
17. 0.005 0.019 ↑ 1.0 1 1

Hash (cost=2.36..2.36 rows=1 width=32) (actual time=0.019..0.019 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=2
18. 0.005 0.014 ↑ 1.0 1 1

Aggregate (cost=2.34..2.35 rows=1 width=32) (actual time=0.014..0.014 rows=1 loops=1)

  • Buffers: shared hit=2
19. 0.009 0.009 ↑ 1.0 1 1

Index Scan using m_product_lower_description on m_product m_product_1 (cost=0.12..2.34 rows=1 width=6) (actual time=0.008..0.009 rows=1 loops=1)

  • Buffers: shared hit=2
20. 28.477 170.862 ↑ 1.0 1 28,477

Aggregate (cost=3.18..3.19 rows=1 width=8) (actual time=0.006..0.006 rows=1 loops=28,477)

  • Buffers: shared hit=154711
21. 142.385 142.385 ↓ 0.0 0 28,477

Index Scan using c_orderline_order on c_orderline c_orderline_2 (cost=0.42..3.18 rows=1 width=0) (actual time=0.005..0.005 rows=0 loops=28,477)

  • Index Cond: (c_order_id = c_order.c_order_id)
  • Filter: (m_product_id = ANY ('{2020603,2020712}'::numeric[]))
  • Rows Removed by Filter: 5
  • Buffers: shared hit=154711
22. 0.002 0.002 ↓ 0.0 0 1

Index Scan using ad_private_access_pkey on ad_private_access (cost=0.15..7.15 rows=1 width=16) (actual time=0.002..0.002 rows=0 loops=1)

  • Index Cond: (ad_table_id = '259'::numeric)
  • Filter: ((ad_user_id <> '100'::numeric) AND (isactive = 'Y'::bpchar))
  • Buffers: shared hit=1
Planning time : 4.307 ms
Execution time : 1,883.012 ms