explain.depesz.com

PostgreSQL's explain analyze made readable

Result: f6n2

Settings
# exclusive inclusive rows x rows loops node
1. 7.684 819,330.244 ↑ 1.0 1 1

Aggregate (cost=1,254,760,244.66..1,254,760,244.67 rows=1 width=41) (actual time=819,330.244..819,330.244 rows=1 loops=1)

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

Seq Scan on dp_import_delivery (cost=0.00..1,743,993.39 rows=3,385 width=41) (actual time=5,678.910..5,700.699 rows=491 loops=1)

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

SubPlan (forAggregate)

4. 1.473 407,390.556 ↑ 1.0 1 491

Limit (cost=185,083.63..185,083.63 rows=1 width=8) (actual time=829.715..829.716 rows=1 loops=491)

5. 5.892 407,389.083 ↑ 2.0 1 491

Sort (cost=185,083.63..185,083.64 rows=2 width=8) (actual time=829.713..829.713 rows=1 loops=491)

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

Seq Scan on dp_import_delivery sub (cost=0.00..185,083.62 rows=2 width=8) (actual time=827.021..829.701 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: 3008310
7. 1.473 406,231.305 ↑ 1.0 1 491

Limit (cost=185,083.63..185,083.63 rows=1 width=8) (actual time=827.354..827.355 rows=1 loops=491)

8. 6.874 406,229.832 ↑ 2.0 1 491

Sort (cost=185,083.63..185,083.64 rows=2 width=8) (actual time=827.352..827.352 rows=1 loops=491)

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

Seq Scan on dp_import_delivery sub_1 (cost=0.00..185,083.62 rows=2 width=8) (actual time=824.674..827.338 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: 3008310