explain.depesz.com

PostgreSQL's explain analyze made readable

Result: yFd

Settings
# exclusive inclusive rows x rows loops node
1. 0.012 3,561.498 ↑ 1.0 100 1

Limit (cost=351,328.74..351,354.74 rows=100 width=1,399) (actual time=3,561.115..3,561.498 rows=100 loops=1)

2. 0.330 3,561.486 ↑ 4,007.1 100 1

Unique (cost=351,328.74..455,512.82 rows=400,708 width=1,399) (actual time=3,561.114..3,561.486 rows=100 loops=1)

3. 2,030.377 3,561.156 ↑ 4,007.1 100 1

Sort (cost=351,328.74..352,330.51 rows=400,708 width=1,399) (actual time=3,561.113..3,561.156 rows=100 loops=1)

  • Sort Key: main_order.datetime_action DESC, main_order.id, main_order.status, main_order.additional_status, main_order.pay_type_id, main_order.pay_status, main_order.sale, main_order.purchase, main_order.sale_result, main_order.refund_sum, main_order.operator_id, main_order.operator_prev_id, main_order.site_id, main_order.client_id, main_order.client_address, main_order.client_subway, main_order.client_post_code, main_order.client_location, main_order.client_referer, main_order.client_ip, main_order.delivery_type, main_order.delivery_status, main_order.datetime_delivery_st, main_order.datetime_delivery_fn, main_order.datetime_ransom_st, main_order.datetime_ransom_fn, main_order.courier_id, main_order.courier_pay, main_order.courier_pay_sum, main_order.courier_trip, main_order.purchase_sum, main_order.comment, main_order.client_comment, main_order.info, main_order.rejection, main_order.datetime_create, main_order.datetime_sale, main_order.datetime_complete, main_order.is_staff, main_order.is_check, main_order.is_check2, main_order.old_bintranet_id, main_order.custom_id, main_order.certificate_id, main_order.promocode, main_order.language, main_order.device, main_order.transition, main_order.advert, main_order.advertising_company, main_order.transition_string, main_order.advertising_campaign_id, main_order.advertising_group_id, main_order.term_id, main_order.utm, main_order.cid, main_order.calls, main_order.data, main_paytype.id, main_paytype.name, main_paytype.first_proc, main_paytype.second_proc, main_paytype.is_active, main_paytype.is_link, main_paytype.is_default, main_site.name, main_site.russian_name, main_site.type_id, main_site.city_id, main_site.pay_type_id, main_site.pay_site_id, main_site.language, main_site.is_active, main_site.phone, main_site.email_serv, main_site.email, main_site.email_pass, main_site.tpl_link, main_site.tpl_tickets, main_site.tpl_addorder_link, main_site.tpl_callback, main_site.is_new_acquiring, main_site.is_work, main_site.original, main_site.sendsay_apikey, main_site.sendsay_group_id, main_site.sendsay_subscribe_group_id, main_site.ua, main_client.name, main_client.phone, main_client.phone_code, main_client.email, main_client.info, main_additionalorder.id, main_additionalorder.order_id, main_additionalorder.price, main_additionalorder.price_acq, main_additionalorder.price_result, main_additionalorder.pay_type_id, main_additionalorder.pay_status, main_additionalorder.datetime_create, main_additionalorder.link, main_additionalorder.order_sell_on
  • Sort Method: external merge Disk: 823,296kB
4. 232.856 1,530.779 ↓ 1.1 432,961 1

Hash Left Join (cost=17,675.12..70,245.97 rows=400,708 width=1,399) (actual time=172.288..1,530.779 rows=432,961 loops=1)

  • Hash Cond: (main_order.id = main_additionalorder.order_id)
5. 344.969 1,297.504 ↓ 1.1 432,961 1

Hash Join (cost=17,633.58..69,152.56 rows=400,708 width=1,349) (actual time=171.856..1,297.504 rows=432,961 loops=1)

  • Hash Cond: (main_order.client_id = main_client.id)
6. 215.160 782.335 ↓ 1.1 432,961 1

Hash Left Join (cost=85.99..50,553.11 rows=400,708 width=1,300) (actual time=1.020..782.335 rows=432,961 loops=1)

  • Hash Cond: (main_order.pay_type_id = main_paytype.id)
7. 380.623 567.152 ↓ 1.1 432,961 1

Hash Join (cost=83.87..49,410.00 rows=400,708 width=1,261) (actual time=0.988..567.152 rows=432,961 loops=1)

  • Hash Cond: (main_order.site_id = main_site.id)
8. 185.562 185.562 ↓ 1.0 436,205 1

Seq Scan on main_order (cost=0.00..48,198.35 rows=426,798 width=771) (actual time=0.010..185.562 rows=436,205 loops=1)

  • Filter: ((datetime_create >= '2018-04-20 00:00:00+03'::timestamp with time zone) AND (id >= 606,619))
  • Rows Removed by Filter: 5,466
9. 0.458 0.967 ↓ 1.0 603 1

Hash (cost=76.38..76.38 rows=599 width=490) (actual time=0.967..0.967 rows=603 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 331kB
10. 0.509 0.509 ↓ 1.0 603 1

Seq Scan on main_site (cost=0.00..76.38 rows=599 width=490) (actual time=0.007..0.509 rows=603 loops=1)

  • Filter: is_active
  • Rows Removed by Filter: 40
11. 0.009 0.023 ↓ 1.0 52 1

Hash (cost=1.50..1.50 rows=50 width=39) (actual time=0.023..0.023 rows=52 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 12kB
12. 0.014 0.014 ↓ 1.0 52 1

Seq Scan on main_paytype (cost=0.00..1.50 rows=50 width=39) (actual time=0.007..0.014 rows=52 loops=1)

13. 100.312 170.200 ↑ 1.1 374,465 1

Hash (cost=12,618.37..12,618.37 rows=394,337 width=49) (actual time=170.200..170.200 rows=374,465 loops=1)

  • Buckets: 524,288 Batches: 1 Memory Usage: 34,148kB
14. 69.888 69.888 ↑ 1.1 374,465 1

Seq Scan on main_client (cost=0.00..12,618.37 rows=394,337 width=49) (actual time=0.010..69.888 rows=374,465 loops=1)

15. 0.199 0.419 ↑ 1.0 1,223 1

Hash (cost=26.24..26.24 rows=1,224 width=50) (actual time=0.419..0.419 rows=1,223 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 120kB
16. 0.220 0.220 ↓ 1.0 1,228 1

Seq Scan on main_additionalorder (cost=0.00..26.24 rows=1,224 width=50) (actual time=0.009..0.220 rows=1,228 loops=1)

Planning time : 10.293 ms
Execution time : 3,704.267 ms