explain.depesz.com

PostgreSQL's explain analyze made readable

Result: YItN

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 164.599 1,906.303 ↓ 1.1 28,477 1

Sort (cost=13,435,512.57..13,435,574.55 rows=24,789 width=1,533) (actual time=1,881.789..1,906.303 rows=28,477 loops=1)

  • Sort Key: c_order.created DESC
  • Sort Method: external merge Disk: 14528kB
  • Buffers: shared hit=670983, 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. 773.483 1,741.703 ↓ 1.1 28,477 1

Seq Scan on c_order (cost=7.16..13,414,347.19 rows=24,789 width=1,533) (actual time=3.203..1,741.703 rows=28,477 loops=1)

  • Filter: ((ad_client_id = ANY ('{0,2000006}'::numeric[])) AND ((c_order_id IS NULL) OR (NOT (hashed SubPlan 8))) AND (issotrx = 'Y'::bpchar) AND ((processed = 'N'::bpchar) OR (updated > (now() - '1'::numeric))))
  • Rows Removed by Filter: 68017
  • Buffers: shared hit=670980
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.006..0.006 rows=1 loops=28,477)

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

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

  • Buffers: shared hit=155007
9. 84.784 284.770 ↓ 0.0 0 28,477

Hash Semi Join (cost=53.67..56.42 rows=1 width=0) (actual time=0.010..0.010 rows=0 loops=28,477)

  • Hash Cond: (c_orderline.m_product_id = ($4))
  • Buffers: shared hit=155007
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.006 0.647 ↑ 1.0 1 1

Hash (cost=53.23..53.23 rows=1 width=32) (actual time=0.647..0.647 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=296
12. 0.002 0.641 ↑ 1.0 1 1

Result (cost=53.21..53.22 rows=1 width=32) (actual time=0.641..0.641 rows=1 loops=1)

  • Buffers: shared hit=296
13.          

Initplan (for Result)

14. 0.002 0.639 ↑ 1.0 1 1

Limit (cost=0.28..53.21 rows=1 width=6) (actual time=0.638..0.639 rows=1 loops=1)

  • Buffers: shared hit=296
15. 0.637 0.637 ↑ 11.0 1 1

Index Scan Backward using m_product_pkey on m_product (cost=0.28..582.51 rows=11 width=6) (actual time=0.637..0.637 rows=1 loops=1)

  • Index Cond: (m_product_id IS NOT NULL)
  • Filter: ((lower((description)::text) ~~ '%bolsa%'::text) AND (lower((description)::text) !~~ '%descuento%'::text))
  • Rows Removed by Filter: 638
  • Buffers: shared hit=296
16. 0.000 170.862 ↑ 1.0 1 28,477

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

  • Buffers: shared hit=155041
17. 54.838 170.862 ↓ 0.0 0 28,477

Hash Semi Join (cost=472.30..475.05 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=155041
18. 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
19. 0.009 2.116 ↑ 1.0 1 1

Hash (cost=471.86..471.86 rows=1 width=32) (actual time=2.116..2.116 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=330
20. 0.009 2.107 ↑ 1.0 1 1

Aggregate (cost=471.84..471.85 rows=1 width=32) (actual time=2.107..2.107 rows=1 loops=1)

  • Buffers: shared hit=330
21. 2.098 2.098 ↑ 1.0 1 1

Seq Scan on m_product m_product_1 (cost=0.00..471.84 rows=1 width=6) (actual time=0.279..2.098 rows=1 loops=1)

  • Filter: ((lower((description)::text) ~~ '%bolsa%'::text) AND (lower((description)::text) ~~ '%descuento%'::text))
  • Rows Removed by Filter: 7102
  • Buffers: shared hit=330
22. 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
23. 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
24. 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 : 3.922 ms
Execution time : 1,911.092 ms