explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 5vhO

Settings
# exclusive inclusive rows x rows loops node
1. 8.317 824,701.366 ↑ 1.0 1 1

Aggregate (cost=1,255,529,092.07..1,255,529,092.08 rows=1 width=41) (actual time=824,701.365..824,701.366 rows=1 loops=1)

2. 5,685.900 5,685.900 ↑ 6.9 491 1

Seq Scan on dp_import_delivery (cost=0.00..1,744,547.64 rows=3,386 width=41) (actual time=5,662.949..5,685.900 rows=491 loops=1)

  • Filter: (((status)::text = '30'::text) AND (trunc(created) = trunc(now())))
  • Rows Removed by Filter: 3008316
3.          

SubPlan (forAggregate)

4. 0.982 410,001.203 ↑ 1.0 1 491

Limit (cost=185,142.42..185,142.42 rows=1 width=8) (actual time=835.033..835.033 rows=1 loops=491)

5. 5.892 410,000.221 ↑ 2.0 1 491

Sort (cost=185,142.42..185,142.43 rows=2 width=8) (actual time=835.031..835.031 rows=1 loops=491)

  • Sort Key: sub.created
  • Sort Method: top-N heapsort Memory: 25kB
6. 409,994.329 409,994.329 ↑ 1.0 2 491

Seq Scan on dp_import_delivery sub (cost=0.00..185,142.41 rows=2 width=8) (actual time=832.023..835.019 rows=2 loops=491)

  • Filter: (((dp_import_delivery.c_order_id)::text = (c_order_id)::text) AND ((status)::text = '20'::text))
  • Rows Removed by Filter: 3008805
7. 1.473 409,005.946 ↑ 1.0 1 491

Limit (cost=185,142.42..185,142.42 rows=1 width=8) (actual time=833.006..833.006 rows=1 loops=491)

8. 6.874 409,004.473 ↑ 2.0 1 491

Sort (cost=185,142.42..185,142.43 rows=2 width=8) (actual time=833.003..833.003 rows=1 loops=491)

  • Sort Key: sub_1.created
  • Sort Method: top-N heapsort Memory: 25kB
9. 408,997.599 408,997.599 ↑ 1.0 2 491

Seq Scan on dp_import_delivery sub_1 (cost=0.00..185,142.41 rows=2 width=8) (actual time=830.001..832.989 rows=2 loops=491)

  • Filter: (((dp_import_delivery.c_order_id)::text = (c_order_id)::text) AND ((status)::text = '20'::text))
  • Rows Removed by Filter: 3008805