explain.depesz.com

PostgreSQL's explain analyze made readable

Result: NHcj

Settings
# exclusive inclusive rows x rows loops node
1. 0.363 289.208 ↑ 2.0 246 1

Sort (cost=138,954.41..138,955.63 rows=490 width=1,216) (actual time=289.183..289.208 rows=246 loops=1)

  • Sort Key: o.orderid DESC
  • Sort Method: quicksort Memory: 265kB
2. 0.575 288.845 ↑ 2.0 246 1

Hash Left Join (cost=39,426.31..138,932.51 rows=490 width=1,216) (actual time=262.762..288.845 rows=246 loops=1)

  • Hash Cond: ((ccu.salerankid)::integer = (sr.salerankid)::integer)
3. 0.132 288.193 ↑ 1.2 246 1

Nested Loop Left Join (cost=39,420.48..138,914.21 rows=291 width=1,121) (actual time=262.650..288.193 rows=246 loops=1)

4. 0.069 287.569 ↑ 1.2 246 1

Nested Loop Left Join (cost=39,420.06..138,179.69 rows=291 width=1,094) (actual time=262.634..287.569 rows=246 loops=1)

5. 0.191 286.762 ↑ 1.2 246 1

Nested Loop Left Join (cost=39,419.64..137,930.77 rows=291 width=1,063) (actual time=262.616..286.762 rows=246 loops=1)

6. 0.117 286.571 ↑ 1.2 246 1

Hash Left Join (cost=39,419.50..137,423.27 rows=291 width=1,032) (actual time=262.603..286.571 rows=246 loops=1)

  • Hash Cond: ((o.expensesclauseid)::integer = (ec.expensesclauseid)::integer)
7. 0.176 286.399 ↑ 1.2 246 1

Nested Loop Left Join (cost=39,415.03..137,417.64 rows=291 width=968) (actual time=262.538..286.399 rows=246 loops=1)

8. 0.079 285.731 ↑ 1.2 246 1

Nested Loop (cost=39,414.61..136,683.12 rows=291 width=937) (actual time=262.519..285.731 rows=246 loops=1)

9. 0.164 285.160 ↑ 1.2 246 1

Nested Loop Left Join (cost=39,414.32..135,987.29 rows=291 width=908) (actual time=262.500..285.160 rows=246 loops=1)

10. 0.179 284.012 ↑ 1.2 246 1

Hash Join (cost=39,413.90..135,252.77 rows=291 width=877) (actual time=262.476..284.012 rows=246 loops=1)

  • Hash Cond: ((o.currencyid)::integer = (oc.currencyid)::integer)
11. 0.244 283.808 ↑ 1.2 246 1

Nested Loop (cost=39,412.83..135,247.70 rows=291 width=681) (actual time=262.426..283.808 rows=246 loops=1)

12. 0.155 282.826 ↑ 1.2 246 1

Hash Left Join (cost=39,412.54..135,036.78 rows=291 width=650) (actual time=262.402..282.826 rows=246 loops=1)

  • Hash Cond: ((co.contractpaymenttypeid)::integer = (cpt.contractpaymenttypeid)::integer)
13. 0.093 282.659 ↑ 1.2 246 1

Hash Left Join (cost=39,411.43..135,031.68 rows=291 width=504) (actual time=262.380..282.659 rows=246 loops=1)

  • Hash Cond: ((co.contracttypeid)::integer = (ct.contracttypeid)::integer)
14. 0.213 282.556 ↑ 1.2 246 1

Nested Loop Left Join (cost=39,409.98..135,026.60 rows=291 width=358) (actual time=262.360..282.556 rows=246 loops=1)

15. 0.163 281.851 ↑ 1.2 246 1

Hash Left Join (cost=39,409.56..134,317.83 rows=291 width=336) (actual time=262.344..281.851 rows=246 loops=1)

  • Hash Cond: ((cso.contracttypeid)::integer = (csot.contracttypeid)::integer)
16. 0.315 281.667 ↑ 1.2 246 1

Nested Loop Left Join (cost=39,408.11..134,312.75 rows=291 width=190) (actual time=262.268..281.667 rows=246 loops=1)

17. 0.160 280.614 ↑ 1.2 246 1

Hash Join (cost=39,407.69..134,151.34 rows=291 width=190) (actual time=262.245..280.614 rows=246 loops=1)

  • Hash Cond: ((o.stateid)::integer = (oos.stateid)::integer)
18. 0.234 280.375 ↑ 1.2 246 1

Nested Loop (cost=39,403.60..134,143.25 rows=291 width=167) (actual time=262.142..280.375 rows=246 loops=1)

19. 0.509 279.403 ↑ 1.2 246 1

Nested Loop (cost=39,403.31..133,875.58 rows=291 width=151) (actual time=262.114..279.403 rows=246 loops=1)

20. 17.606 277.664 ↑ 27.4 246 1

Bitmap Heap Scan on orders o (cost=39,402.88..82,033.10 rows=6,734 width=147) (actual time=262.071..277.664 rows=246 loops=1)

  • Recheck Cond: ((date >= '2019-08-03 00:00:00+03'::timestamp with time zone) AND isinwork AND (objectstatusid <= 1))
  • Filter: (hashed SubPlan 1)
  • Rows Removed by Filter: 16246
  • Heap Blocks: exact=9138
21. 5.715 179.485 ↓ 0.0 0 1

BitmapAnd (cost=14,930.96..14,930.96 rows=13,468 width=0) (actual time=179.485..179.485 rows=0 loops=1)

22. 17.221 17.221 ↓ 1.0 57,313 1

Bitmap Index Scan on i_orders_date (cost=0.00..1,398.54 rows=55,214 width=0) (actual time=17.221..17.221 rows=57,313 loops=1)

  • Index Cond: (date >= '2019-08-03 00:00:00+03'::timestamp with time zone)
23. 156.549 156.549 ↓ 1.3 891,604 1

Bitmap Index Scan on i_objecttasks_customerid_isinwork (cost=0.00..13,528.81 rows=704,076 width=0) (actual time=156.549..156.549 rows=891,604 loops=1)

24.          

SubPlan (forBitmap Heap Scan)

25. 0.000 80.573 ↓ 830.0 830 1

Nested Loop (cost=2,480.94..24,471.92 rows=1 width=4) (actual time=57.586..80.573 rows=830 loops=1)

26. 1.751 77.315 ↓ 11.1 830 1

Nested Loop (cost=2,480.38..23,920.19 rows=75 width=8) (actual time=57.555..77.315 rows=830 loops=1)

27. 7.589 64.184 ↓ 4.4 5,690 1

Bitmap Heap Scan on orders o_1 (cost=2,479.97..7,329.26 rows=1,286 width=4) (actual time=57.436..64.184 rows=5,690 loops=1)

  • Recheck Cond: (isinwork AND ((supplierid)::integer = 6) AND (date >= '2019-08-03 00:00:00+03'::timestamp with time zone))
  • Heap Blocks: exact=4418
28. 15.267 56.595 ↓ 0.0 0 1

BitmapAnd (cost=2,479.97..2,479.97 rows=1,286 width=0) (actual time=56.595..56.595 rows=0 loops=1)

29. 30.139 30.139 ↓ 2.9 193,096 1

Bitmap Index Scan on i_orders_samples_isinwork (cost=0.00..1,080.55 rows=67,225 width=0) (actual time=30.139..30.139 rows=193,096 loops=1)

30. 11.189 11.189 ↓ 1.0 57,313 1

Bitmap Index Scan on i_orders_date (cost=0.00..1,398.54 rows=55,214 width=0) (actual time=11.189..11.189 rows=57,313 loops=1)

  • Index Cond: (date >= '2019-08-03 00:00:00+03'::timestamp with time zone)
31. 11.380 11.380 ↓ 0.0 0 5,690

Index Scan using i_orderitemreserves_orderid_amountnot0 on orderitemreserves oir (cost=0.41..12.89 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=5,690)

  • Index Cond: ((orderid)::integer = (o_1.orderid)::integer)
  • Filter: ((storegroupid)::integer = 10)
  • Rows Removed by Filter: 0
32. 3.320 3.320 ↑ 1.0 1 830

Index Scan using i_orderitems_orderitemidobjectstatusid on orderitems oi (cost=0.56..7.35 rows=1 width=4) (actual time=0.003..0.004 rows=1 loops=830)

  • Index Cond: ((orderitemid)::integer = (oir.orderitemid)::integer)
  • Filter: (COALESCE(amountgiven, 0) = 0)
33. 1.230 1.230 ↑ 1.0 1 246

Index Scan using i_suborder_order on suborders so (cost=0.43..7.69 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=246)

  • Index Cond: ((orderid)::integer = (o.orderid)::integer)
  • Filter: ((objectstatusid <= 1) AND ((pickupstoreid)::integer = 62))
34. 0.738 0.738 ↑ 1.0 1 246

Index Scan using customers_pkey on customers ccu (cost=0.29..0.91 rows=1 width=16) (actual time=0.003..0.003 rows=1 loops=246)

  • Index Cond: ((customerid)::integer = (o.customerid)::integer)
35. 0.043 0.079 ↑ 1.0 93 1

Hash (cost=2.93..2.93 rows=93 width=31) (actual time=0.079..0.079 rows=93 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
36. 0.036 0.036 ↑ 1.0 93 1

Seq Scan on states oos (cost=0.00..2.93 rows=93 width=31) (actual time=0.006..0.036 rows=93 loops=1)

37. 0.738 0.738 ↑ 1.0 1 246

Index Scan using contracts_pkey on contracts cso (cost=0.42..0.54 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=246)

  • Index Cond: ((contractid)::integer = (so.contractid)::integer)
38. 0.007 0.021 ↓ 1.1 22 1

Hash (cost=1.20..1.20 rows=20 width=150) (actual time=0.021..0.021 rows=22 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
39. 0.014 0.014 ↓ 1.1 22 1

Seq Scan on contracttypes csot (cost=0.00..1.20 rows=20 width=150) (actual time=0.011..0.014 rows=22 loops=1)

40. 0.492 0.492 ↑ 1.0 1 246

Index Scan using contracts_pkey on contracts co (cost=0.42..2.43 rows=1 width=26) (actual time=0.002..0.002 rows=1 loops=246)

  • Index Cond: ((contractid)::integer = (o.contractid)::integer)
41. 0.006 0.010 ↓ 1.1 22 1

Hash (cost=1.20..1.20 rows=20 width=150) (actual time=0.010..0.010 rows=22 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
42. 0.004 0.004 ↓ 1.1 22 1

Seq Scan on contracttypes ct (cost=0.00..1.20 rows=20 width=150) (actual time=0.002..0.004 rows=22 loops=1)

43. 0.002 0.012 ↑ 1.0 5 1

Hash (cost=1.05..1.05 rows=5 width=150) (actual time=0.012..0.012 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
44. 0.010 0.010 ↑ 1.0 5 1

Seq Scan on contractpaymenttypes cpt (cost=0.00..1.05 rows=5 width=150) (actual time=0.009..0.010 rows=5 loops=1)

45. 0.738 0.738 ↑ 1.0 1 246

Index Scan using companies_pkey on companies cc (cost=0.29..0.71 rows=1 width=39) (actual time=0.003..0.003 rows=1 loops=246)

  • Index Cond: ((companyid)::integer = (ccu.customerid)::integer)
46. 0.016 0.025 ↑ 1.0 3 1

Hash (cost=1.03..1.03 rows=3 width=200) (actual time=0.025..0.025 rows=3 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
47. 0.009 0.009 ↑ 1.0 3 1

Seq Scan on currencies oc (cost=0.00..1.03 rows=3 width=200) (actual time=0.006..0.009 rows=3 loops=1)

48. 0.984 0.984 ↑ 1.0 1 246

Index Scan using persons_pkey on persons jpcc (cost=0.42..2.51 rows=1 width=35) (actual time=0.004..0.004 rows=1 loops=246)

  • Index Cond: ((personid)::integer = (o.customerjpid)::integer)
49. 0.492 0.492 ↑ 1.0 1 246

Index Scan using companies_pkey on companies sc (cost=0.29..2.38 rows=1 width=33) (actual time=0.001..0.002 rows=1 loops=246)

  • Index Cond: ((companyid)::integer = (o.supplierid)::integer)
50. 0.492 0.492 ↑ 1.0 1 246

Index Scan using persons_pkey on persons jpsc (cost=0.42..2.51 rows=1 width=35) (actual time=0.002..0.002 rows=1 loops=246)

  • Index Cond: ((personid)::integer = (o.supplierjpid)::integer)
51. 0.024 0.055 ↑ 1.0 110 1

Hash (cost=3.10..3.10 rows=110 width=68) (actual time=0.055..0.055 rows=110 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 19kB
52. 0.031 0.031 ↑ 1.0 110 1

Seq Scan on expensesclauses ec (cost=0.00..3.10 rows=110 width=68) (actual time=0.008..0.031 rows=110 loops=1)

53. 0.000 0.000 ↓ 0.0 0 246

Index Scan using i_persons_role_10 on persons frc (cost=0.14..1.73 rows=1 width=35) (actual time=0.000..0.000 rows=0 loops=246)

  • Index Cond: ((personid)::integer = (o.frcid)::integer)
54. 0.738 0.738 ↑ 1.0 1 246

Index Scan using persons_pkey on persons sm (cost=0.42..0.85 rows=1 width=35) (actual time=0.002..0.003 rows=1 loops=246)

  • Index Cond: ((personid)::integer = ccu.salesid)
55. 0.492 0.492 ↑ 1.0 1 246

Index Scan using persons_pkey on persons sp (cost=0.42..2.51 rows=1 width=35) (actual time=0.002..0.002 rows=1 loops=246)

  • Index Cond: ((personid)::integer = (o.ownpersonid)::integer)
56. 0.006 0.077 ↑ 1.6 20 1

Hash (cost=5.42..5.42 rows=32 width=36) (actual time=0.077..0.077 rows=20 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
57. 0.013 0.071 ↑ 1.6 20 1

Hash Right Join (cost=2.78..5.42 rows=32 width=36) (actual time=0.049..0.071 rows=20 loops=1)

  • Hash Cond: ((srp_1.salerankid)::integer = (sr.salerankid)::integer)
58. 0.021 0.044 ↑ 3.2 10 1

Hash Join (cost=1.36..3.56 rows=32 width=15) (actual time=0.027..0.044 rows=10 loops=1)

  • Hash Cond: ((srp_1.contractcompanyid)::integer = (cc_1.contractcompanyid)::integer)
59. 0.012 0.012 ↑ 1.0 64 1

Seq Scan on salerankparams srp_1 (cost=0.00..1.64 rows=64 width=19) (actual time=0.005..0.012 rows=64 loops=1)

60. 0.002 0.011 ↑ 11.0 1 1

Hash (cost=1.22..1.22 rows=11 width=4) (actual time=0.011..0.011 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
61. 0.009 0.009 ↑ 11.0 1 1

Seq Scan on contractcompanies cc_1 (cost=0.00..1.22 rows=11 width=4) (actual time=0.008..0.009 rows=1 loops=1)

  • Filter: isdefault
  • Rows Removed by Filter: 21
62. 0.004 0.014 ↓ 1.1 20 1

Hash (cost=1.19..1.19 rows=19 width=150) (actual time=0.014..0.014 rows=20 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
63. 0.010 0.010 ↓ 1.1 20 1

Seq Scan on saleranks sr (cost=0.00..1.19 rows=19 width=150) (actual time=0.006..0.010 rows=20 loops=1)

Planning time : 23.860 ms
Execution time : 290.620 ms