explain.depesz.com

PostgreSQL's explain analyze made readable

Result: BUZl : Optimization for: plan #x38Q

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.002 1.792 ↑ 10.0 1 1

Limit (cost=65,174.53..65,174.55 rows=10 width=2,961) (actual time=1.791..1.792 rows=1 loops=1)

2.          

CTE filtered_orders

3. 0.167 0.370 ↑ 12,421.0 1 1

HashAggregate (cost=14,701.88..14,826.09 rows=12,421 width=549) (actual time=0.275..0.370 rows=1 loops=1)

  • Group Key: o1.id, o1.deleted, o1.id_ek5, o1.number
4. 0.004 0.203 ↑ 6,210.5 2 1

Append (cost=0.56..14,577.67 rows=12,421 width=549) (actual time=0.068..0.203 rows=2 loops=1)

5. 0.068 0.068 ↑ 6,190.0 1 1

Index Scan using idx_order_sender_code_date_deleted_ex on "order" o1 (cost=0.56..7,106.19 rows=6,190 width=43) (actual time=0.066..0.068 rows=1 loops=1)

  • Index Cond: (((sender_contragent_code)::text = '56090b33d83467dd84bd15ce'::text) AND (deleted = false) AND (date_time_create >= '2019-08-07 00:00:00'::timestamp without time zone) AND (date_time_create <= '2019-09-07 23:59:59'::timestamp without time zone))
  • Filter: (NOT deleted)
6. 0.091 0.091 ↓ 0.0 0 1

Index Scan using idx_order_receiver_code on "order" o1_1 (cost=0.56..178.98 rows=41 width=43) (actual time=0.091..0.091 rows=0 loops=1)

  • Index Cond: ((receiver_contragent_code)::text = '56090b33d83467dd84bd15ce'::text)
  • Filter: ((NOT deleted) AND (date_time_create >= '2019-08-07 00:00:00'::timestamp without time zone) AND (date_time_create <= '2019-09-07 23:59:59'::timestamp without time zone))
  • Rows Removed by Filter: 13
7. 0.040 0.040 ↑ 6,190.0 1 1

Index Scan using idx_order_sender_code_date_deleted_ex on "order" o1_2 (cost=0.56..7,106.19 rows=6,190 width=43) (actual time=0.039..0.040 rows=1 loops=1)

  • Index Cond: (((sender_contragent_code)::text = '56090b33d83467dd84bd15ce'::text) AND (deleted = false) AND (date_time_create >= '2019-08-07 00:00:00'::timestamp without time zone) AND (date_time_create <= '2019-09-07 23:59:59'::timestamp without time zone))
  • Filter: (NOT deleted)
8. 0.013 1.790 ↑ 12,594.0 1 1

Sort (cost=50,348.44..50,379.93 rows=12,594 width=2,961) (actual time=1.789..1.790 rows=1 loops=1)

  • Sort Key: o.date_time_create DESC
  • Sort Method: quicksort Memory: 25kB
9. 0.188 1.777 ↑ 12,594.0 1 1

Nested Loop Left Join (cost=34,903.14..50,076.29 rows=12,594 width=2,961) (actual time=1.554..1.777 rows=1 loops=1)

10. 0.103 1.576 ↑ 12,507.0 1 1

Nested Loop Left Join (cost=34,902.71..42,707.68 rows=12,507 width=3,432) (actual time=1.354..1.576 rows=1 loops=1)

11. 0.011 1.457 ↑ 12,421.0 1 1

Nested Loop Left Join (cost=34,902.28..35,608.63 rows=12,421 width=3,556) (actual time=1.235..1.457 rows=1 loops=1)

  • Join Filter: (o.order_additional_status_code = delivery_detail_additional_status.code)
  • Rows Removed by Join Filter: 27
12. 0.017 1.389 ↑ 12,421.0 1 1

Hash Left Join (cost=34,902.13..35,419.95 rows=12,421 width=3,040) (actual time=1.167..1.389 rows=1 loops=1)

  • Hash Cond: (o.tariff_type_code = tariff_type.code)
13. 0.011 0.858 ↑ 12,421.0 1 1

Nested Loop Left Join (cost=34,875.23..35,359.95 rows=12,421 width=3,007) (actual time=0.637..0.858 rows=1 loops=1)

  • Join Filter: (o.order_status_code = order_status.code)
  • Rows Removed by Join Filter: 25
14. 0.106 0.659 ↑ 12,421.0 1 1

Hash Right Join (cost=34,875.08..35,170.14 rows=12,421 width=1,971) (actual time=0.589..0.659 rows=1 loops=1)

  • Hash Cond: (so.id_ek5 = o.straight_ek5_id)
15. 0.001 0.001 ↑ 12,421.0 1 1

CTE Scan on filtered_orders so (cost=0.00..248.42 rows=12,421 width=532) (actual time=0.001..0.001 rows=1 loops=1)

16. 0.005 0.552 ↑ 12,421.0 1 1

Hash (cost=34,719.82..34,719.82 rows=12,421 width=1,471) (actual time=0.552..0.552 rows=1 loops=1)

  • Buckets: 16,384 Batches: 1 Memory Usage: 129kB
17. 0.133 0.547 ↑ 12,421.0 1 1

Hash Right Join (cost=34,424.76..34,719.82 rows=12,421 width=1,471) (actual time=0.446..0.547 rows=1 loops=1)

  • Hash Cond: (ro.id_ek5 = o.reverse_ek5_id)
18. 0.002 0.002 ↑ 12,421.0 1 1

CTE Scan on filtered_orders ro (cost=0.00..248.42 rows=12,421 width=532) (actual time=0.001..0.002 rows=1 loops=1)

19. 0.010 0.412 ↑ 12,421.0 1 1

Hash (cost=34,269.50..34,269.50 rows=12,421 width=971) (actual time=0.411..0.412 rows=1 loops=1)

  • Buckets: 16,384 Batches: 1 Memory Usage: 129kB
20. 0.009 0.402 ↑ 12,421.0 1 1

Nested Loop (cost=0.56..34,269.50 rows=12,421 width=971) (actual time=0.306..0.402 rows=1 loops=1)

21. 0.376 0.376 ↑ 12,421.0 1 1

CTE Scan on filtered_orders t (cost=0.00..248.42 rows=12,421 width=16) (actual time=0.280..0.376 rows=1 loops=1)

22. 0.017 0.017 ↑ 1.0 1 1

Index Scan using "idx-order_id" on "order" o (cost=0.56..2.74 rows=1 width=987) (actual time=0.017..0.017 rows=1 loops=1)

  • Index Cond: (id = t.id)
23. 0.017 0.188 ↓ 26.0 26 1

Materialize (cost=0.14..3.49 rows=1 width=1,040) (actual time=0.042..0.188 rows=26 loops=1)

24. 0.066 0.171 ↓ 26.0 26 1

Nested Loop Left Join (cost=0.14..3.49 rows=1 width=1,040) (actual time=0.039..0.171 rows=26 loops=1)

  • Join Filter: (order_status."groupCode" = order_status_group.code)
  • Rows Removed by Join Filter: 29
25. 0.027 0.027 ↓ 26.0 26 1

Index Scan using "idx-order_status-lang" on order_status (cost=0.14..2.36 rows=1 width=524) (actual time=0.015..0.027 rows=26 loops=1)

  • Index Cond: ((lang)::text = 'rus'::text)
26. 0.078 0.078 ↓ 2.0 2 26

Seq Scan on order_status_group (cost=0.00..1.11 rows=1 width=520) (actual time=0.002..0.003 rows=2 loops=26)

  • Filter: ((lang)::text = 'rus'::text)
  • Rows Removed by Filter: 3
27. 0.168 0.514 ↑ 1.0 282 1

Hash (cost=23.38..23.38 rows=282 width=41) (actual time=0.514..0.514 rows=282 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 36kB
28. 0.346 0.346 ↑ 1.0 282 1

Index Scan using "idx-tariff_type-lang" on tariff_type (cost=0.28..23.38 rows=282 width=41) (actual time=0.026..0.346 rows=282 loops=1)

  • Index Cond: ((lang)::text = 'rus'::text)
29. 0.020 0.057 ↓ 27.0 27 1

Materialize (cost=0.14..2.37 rows=1 width=520) (actual time=0.019..0.057 rows=27 loops=1)

30. 0.037 0.037 ↓ 27.0 27 1

Index Scan using "idx-delivery_detail_additional_status-lang" on delivery_detail_additional_status (cost=0.14..2.36 rows=1 width=520) (actual time=0.017..0.037 rows=27 loops=1)

  • Index Cond: ((lang)::text = 'rus'::text)
31. 0.016 0.016 ↑ 1.0 1 1

Index Scan using "idx-city-code-lang" on city rc (cost=0.43..0.57 rows=1 width=29) (actual time=0.016..0.016 rows=1 loops=1)

  • Index Cond: ((code = (((o.receiver)::json #>> '{address,cityCode}'::text[]))::integer) AND ((lang)::text = 'rus'::text))
32. 0.013 0.013 ↑ 1.0 1 1

Index Scan using "idx-city-code-lang" on city sc (cost=0.43..0.57 rows=1 width=29) (actual time=0.013..0.013 rows=1 loops=1)

  • Index Cond: ((code = (((o.sender)::json #>> '{address,cityCode}'::text[]))::integer) AND ((lang)::text = 'rus'::text))
Planning time : 15.816 ms
Execution time : 2.292 ms