explain.depesz.com

PostgreSQL's explain analyze made readable

Result: vNC

Settings
# exclusive inclusive rows x rows loops node
1. 0.332 675.514 ↑ 1.8 271 1

Sort (cost=405,340.45..405,341.64 rows=477 width=1,216) (actual time=675.485..675.514 rows=271 loops=1)

  • Sort Key: o.orderid DESC
  • Sort Method: quicksort Memory: 288kB
2. 0.533 675.182 ↑ 1.8 271 1

Hash Left Join (cost=303,915.81..405,319.23 rows=477 width=1,216) (actual time=649.032..675.182 rows=271 loops=1)

  • Hash Cond: ((ccu.salerankid)::integer = (sr.salerankid)::integer)
3. 0.033 674.585 ↑ 1.0 271 1

Nested Loop Left Join (cost=303,909.98..405,301.26 rows=283 width=1,121) (actual time=648.935..674.585 rows=271 loops=1)

4. 0.206 674.010 ↑ 1.0 271 1

Nested Loop Left Join (cost=303,909.56..404,601.48 rows=283 width=1,094) (actual time=648.920..674.010 rows=271 loops=1)

5. 0.177 673.262 ↑ 1.0 271 1

Nested Loop Left Join (cost=303,909.14..404,359.36 rows=283 width=1,063) (actual time=648.904..673.262 rows=271 loops=1)

6. 0.084 673.085 ↑ 1.0 271 1

Hash Left Join (cost=303,909.00..403,876.87 rows=283 width=1,032) (actual time=648.892..673.085 rows=271 loops=1)

  • Hash Cond: ((o.expensesclauseid)::integer = (ec.expensesclauseid)::integer)
7. 0.089 672.954 ↑ 1.0 271 1

Nested Loop Left Join (cost=303,904.53..403,871.27 rows=283 width=968) (actual time=648.838..672.954 rows=271 loops=1)

8. 0.052 672.323 ↑ 1.0 271 1

Nested Loop (cost=303,904.11..403,171.50 rows=283 width=937) (actual time=648.819..672.323 rows=271 loops=1)

9. 0.310 671.729 ↑ 1.0 271 1

Nested Loop Left Join (cost=303,903.82..402,509.33 rows=283 width=908) (actual time=648.805..671.729 rows=271 loops=1)

10. 0.151 670.606 ↑ 1.0 271 1

Hash Join (cost=303,903.40..401,809.56 rows=283 width=877) (actual time=648.783..670.606 rows=271 loops=1)

  • Hash Cond: ((o.currencyid)::integer = (oc.currencyid)::integer)
11. 0.171 670.443 ↑ 1.0 271 1

Nested Loop (cost=303,902.33..401,804.60 rows=283 width=681) (actual time=648.754..670.443 rows=271 loops=1)

12. 0.156 669.459 ↑ 1.0 271 1

Hash Left Join (cost=303,902.04..401,599.44 rows=283 width=650) (actual time=648.733..669.459 rows=271 loops=1)

  • Hash Cond: ((co.contractpaymenttypeid)::integer = (cpt.contractpaymenttypeid)::integer)
13. 0.117 669.293 ↑ 1.0 271 1

Hash Left Join (cost=303,900.93..401,594.44 rows=283 width=504) (actual time=648.700..669.293 rows=271 loops=1)

  • Hash Cond: ((co.contracttypeid)::integer = (ct.contracttypeid)::integer)
14. 0.120 669.167 ↑ 1.0 271 1

Nested Loop Left Join (cost=303,899.48..401,589.46 rows=283 width=358) (actual time=648.680..669.167 rows=271 loops=1)

15. 0.143 668.505 ↑ 1.0 271 1

Hash Left Join (cost=303,899.06..400,914.11 rows=283 width=336) (actual time=648.668..668.505 rows=271 loops=1)

  • Hash Cond: ((cso.contracttypeid)::integer = (csot.contracttypeid)::integer)
16. 0.189 668.345 ↑ 1.0 271 1

Nested Loop Left Join (cost=303,897.61..400,909.13 rows=283 width=190) (actual time=648.630..668.345 rows=271 loops=1)

17. 0.153 667.343 ↑ 1.0 271 1

Hash Join (cost=303,897.19..400,750.58 rows=283 width=190) (actual time=648.609..667.343 rows=271 loops=1)

  • Hash Cond: ((o.stateid)::integer = (oos.stateid)::integer)
18. 0.157 667.135 ↑ 1.0 271 1

Nested Loop (cost=303,893.10..400,742.60 rows=283 width=167) (actual time=648.534..667.135 rows=271 loops=1)

19. 0.356 666.165 ↑ 1.0 271 1

Nested Loop (cost=303,892.81..400,486.51 rows=283 width=151) (actual time=648.511..666.165 rows=271 loops=1)

20. 17.987 664.454 ↑ 25.5 271 1

Bitmap Heap Scan on orders o (cost=303,892.38..347,448.95 rows=6,905 width=147) (actual time=648.473..664.454 rows=271 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: 16106
  • Heap Blocks: exact=9432
21. 6.516 166.683 ↓ 0.0 0 1

BitmapAnd (cost=15,374.26..15,374.26 rows=13,810 width=0) (actual time=166.683..166.683 rows=0 loops=1)

22. 14.113 14.113 ↓ 1.1 61,717 1

Bitmap Index Scan on i_orders_date (cost=0.00..1,383.48 rows=54,807 width=0) (actual time=14.113..14.113 rows=61,717 loops=1)

  • Index Cond: (date >= '2019-08-03 00:00:00+03'::timestamp with time zone)
23. 146.054 146.054 ↓ 1.2 890,839 1

Bitmap Index Scan on i_objecttasks_customerid_isinwork (cost=0.00..13,987.07 rows=730,930 width=0) (actual time=146.054..146.054 rows=890,839 loops=1)

24.          

SubPlan (forBitmap Heap Scan)

25. 0.566 479.784 ↓ 62.3 935 1

Nested Loop (cost=180,833.13..288,518.08 rows=15 width=4) (actual time=474.911..479.784 rows=935 loops=1)

26. 0.735 476.413 ↑ 4.5 935 1

Hash Join (cost=180,832.57..257,468.60 rows=4,221 width=8) (actual time=474.877..476.413 rows=935 loops=1)

  • Hash Cond: ((oir.orderid)::integer = (o_1.orderid)::integer)
27. 1.281 1.281 ↑ 166.1 1,016 1

Index Scan using i_orderitemreserves_4_samples on orderitemreserves oir (cost=0.28..75,961.23 rows=168,762 width=8) (actual time=0.014..1.281 rows=1,016 loops=1)

  • Filter: ((storegroupid)::integer = 10)
  • Rows Removed by Filter: 497
28. 39.611 474.397 ↓ 2.7 192,931 1

Hash (cost=179,925.34..179,925.34 rows=72,556 width=4) (actual time=474.397..474.397 rows=192,931 loops=1)

  • Buckets: 262144 (originally 131072) Batches: 1 (originally 1) Memory Usage: 8831kB
29. 221.571 434.786 ↓ 2.7 192,931 1

Bitmap Heap Scan on orders o_1 (cost=32,780.80..179,925.34 rows=72,556 width=4) (actual time=242.387..434.786 rows=192,931 loops=1)

  • Recheck Cond: (isinwork AND ((supplierid)::integer = 6))
  • Heap Blocks: exact=117306
30. 44.728 213.215 ↓ 0.0 0 1

BitmapAnd (cost=32,780.80..32,780.80 rows=72,556 width=0) (actual time=213.215..213.215 rows=0 loops=1)

31. 128.217 128.217 ↑ 1.0 889,337 1

Bitmap Index Scan on i_objecttasks_isinwork_firstworkdate (cost=0.00..16,145.21 rows=905,812 width=0) (actual time=128.217..128.217 rows=889,337 loops=1)

32. 40.270 40.270 ↑ 1.0 221,906 1

Bitmap Index Scan on i_orders_supplier (cost=0.00..16,599.06 rows=232,351 width=0) (actual time=40.270..40.270 rows=221,906 loops=1)

  • Index Cond: ((supplierid)::integer = 6)
33. 2.805 2.805 ↑ 1.0 1 935

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

  • Index Cond: ((orderitemid)::integer = (oir.orderitemid)::integer)
  • Filter: (COALESCE(amountgiven, 0) = 0)
34. 1.355 1.355 ↑ 1.0 1 271

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

  • Index Cond: ((orderid)::integer = (o.orderid)::integer)
  • Filter: ((objectstatusid <= 1) AND ((pickupstoreid)::integer = 62))
35. 0.813 0.813 ↑ 1.0 1 271

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

  • Index Cond: ((customerid)::integer = (o.customerid)::integer)
36. 0.029 0.055 ↑ 1.0 93 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
37. 0.026 0.026 ↑ 1.0 93 1

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

38. 0.813 0.813 ↑ 1.0 1 271

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

  • Index Cond: ((contractid)::integer = (so.contractid)::integer)
39. 0.005 0.017 ↓ 1.1 22 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
40. 0.012 0.012 ↓ 1.1 22 1

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

41. 0.542 0.542 ↑ 1.0 1 271

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

  • Index Cond: ((contractid)::integer = (o.contractid)::integer)
42. 0.005 0.009 ↓ 1.1 22 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
43. 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)

44. 0.003 0.010 ↑ 1.0 5 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
45. 0.007 0.007 ↑ 1.0 5 1

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

46. 0.813 0.813 ↑ 1.0 1 271

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=271)

  • Index Cond: ((companyid)::integer = (ccu.customerid)::integer)
47. 0.005 0.012 ↑ 1.0 3 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
48. 0.007 0.007 ↑ 1.0 3 1

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

49. 0.813 0.813 ↑ 1.0 1 271

Index Scan using persons_pkey on persons jpcc (cost=0.42..2.46 rows=1 width=35) (actual time=0.003..0.003 rows=1 loops=271)

  • Index Cond: ((personid)::integer = (o.customerjpid)::integer)
50. 0.542 0.542 ↑ 1.0 1 271

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

  • Index Cond: ((companyid)::integer = (o.supplierid)::integer)
51. 0.542 0.542 ↑ 1.0 1 271

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

  • Index Cond: ((personid)::integer = (o.supplierjpid)::integer)
52. 0.019 0.047 ↑ 1.0 110 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 19kB
53. 0.028 0.028 ↑ 1.0 110 1

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

54. 0.000 0.000 ↓ 0.0 0 271

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

  • Index Cond: ((personid)::integer = (o.frcid)::integer)
55. 0.542 0.542 ↑ 1.0 1 271

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

  • Index Cond: ((personid)::integer = ccu.salesid)
56. 0.542 0.542 ↑ 1.0 1 271

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

  • Index Cond: ((personid)::integer = (o.ownpersonid)::integer)
57. 0.004 0.064 ↑ 1.6 20 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
58. 0.013 0.060 ↑ 1.6 20 1

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

  • Hash Cond: ((srp_1.salerankid)::integer = (sr.salerankid)::integer)
59. 0.018 0.035 ↑ 3.2 10 1

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

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

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

61. 0.001 0.010 ↑ 11.0 1 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
62. 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
63. 0.003 0.012 ↓ 1.1 20 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
64. 0.009 0.009 ↓ 1.1 20 1

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

Planning time : 16.172 ms
Execution time : 676.414 ms