explain.depesz.com

PostgreSQL's explain analyze made readable

Result: uUle

Settings
# exclusive inclusive rows x rows loops node
1. 0.013 717.761 ↓ 0.0 0 1

Sort (cost=380,825.16..380,826.19 rows=413 width=1,216) (actual time=717.761..717.761 rows=0 loops=1)

  • Sort Key: o.orderid DESC
  • Sort Method: quicksort Memory: 25kB
2. 0.003 717.748 ↓ 0.0 0 1

Hash Left Join (cost=286,169.01..380,807.21 rows=413 width=1,216) (actual time=717.748..717.748 rows=0 loops=1)

  • Hash Cond: ((ccu.salerankid)::integer = (sr.salerankid)::integer)
3. 0.002 717.745 ↓ 0.0 0 1

Nested Loop Left Join (cost=286,163.19..380,790.87 rows=245 width=1,121) (actual time=717.745..717.745 rows=0 loops=1)

4. 0.002 717.743 ↓ 0.0 0 1

Nested Loop Left Join (cost=286,162.77..380,108.50 rows=245 width=1,094) (actual time=717.743..717.743 rows=0 loops=1)

5. 0.002 717.741 ↓ 0.0 0 1

Nested Loop Left Join (cost=286,162.35..379,898.89 rows=245 width=1,063) (actual time=717.741..717.741 rows=0 loops=1)

6. 0.002 717.739 ↓ 0.0 0 1

Hash Left Join (cost=286,162.21..379,423.06 rows=245 width=1,032) (actual time=717.739..717.739 rows=0 loops=1)

  • Hash Cond: ((o.expensesclauseid)::integer = (ec.expensesclauseid)::integer)
7. 0.002 717.737 ↓ 0.0 0 1

Nested Loop Left Join (cost=286,157.73..379,417.62 rows=245 width=968) (actual time=717.737..717.737 rows=0 loops=1)

8. 0.002 717.735 ↓ 0.0 0 1

Nested Loop (cost=286,157.31..378,735.25 rows=245 width=937) (actual time=717.735..717.735 rows=0 loops=1)

9. 0.003 717.733 ↓ 0.0 0 1

Nested Loop Left Join (cost=286,157.02..378,117.33 rows=245 width=908) (actual time=717.733..717.733 rows=0 loops=1)

10. 0.013 717.730 ↓ 0.0 0 1

Hash Join (cost=286,156.60..377,434.96 rows=245 width=877) (actual time=717.730..717.730 rows=0 loops=1)

  • Hash Cond: ((o.currencyid)::integer = (oc.currencyid)::integer)
11. 0.002 717.700 ↓ 0.0 0 1

Nested Loop (cost=286,155.53..377,430.53 rows=245 width=681) (actual time=717.700..717.700 rows=0 loops=1)

12. 0.003 717.698 ↓ 0.0 0 1

Hash Left Join (cost=286,155.24..377,252.91 rows=245 width=650) (actual time=717.698..717.698 rows=0 loops=1)

  • Hash Cond: ((co.contractpaymenttypeid)::integer = (cpt.contractpaymenttypeid)::integer)
13. 0.002 717.695 ↓ 0.0 0 1

Hash Left Join (cost=286,154.13..377,248.43 rows=245 width=504) (actual time=717.695..717.695 rows=0 loops=1)

  • Hash Cond: ((co.contracttypeid)::integer = (ct.contracttypeid)::integer)
14. 0.002 717.693 ↓ 0.0 0 1

Nested Loop Left Join (cost=286,152.68..377,243.92 rows=245 width=358) (actual time=717.693..717.693 rows=0 loops=1)

15. 0.002 717.691 ↓ 0.0 0 1

Hash Left Join (cost=286,152.26..376,585.96 rows=245 width=336) (actual time=717.691..717.691 rows=0 loops=1)

  • Hash Cond: ((cso.contracttypeid)::integer = (csot.contracttypeid)::integer)
16. 0.002 717.689 ↓ 0.0 0 1

Nested Loop Left Join (cost=286,150.81..376,581.45 rows=245 width=190) (actual time=717.689..717.689 rows=0 loops=1)

17. 0.012 717.687 ↓ 0.0 0 1

Hash Join (cost=286,150.39..376,444.19 rows=245 width=190) (actual time=717.687..717.687 rows=0 loops=1)

  • Hash Cond: ((o.stateid)::integer = (oos.stateid)::integer)
18. 0.003 717.622 ↓ 0.0 0 1

Nested Loop (cost=286,146.30..376,436.73 rows=245 width=167) (actual time=717.622..717.622 rows=0 loops=1)

19. 0.039 717.619 ↓ 0.0 0 1

Nested Loop (cost=286,146.01..376,192.82 rows=245 width=151) (actual time=717.619..717.619 rows=0 loops=1)

20. 21.809 713.404 ↑ 83.1 72 1

Bitmap Heap Scan on orders o (cost=286,145.58..329,702.15 rows=5,982 width=147) (actual time=693.634..713.404 rows=72 loops=1)

  • Recheck Cond: ((date >= '2019-08-03 00:00:00+03'::timestamp with time zone) AND isinwork AND (objectstatusid <= 1))
  • Filter: ((parentorderid IS NULL) AND (hashed SubPlan 1))
  • Rows Removed by Filter: 16304
  • Heap Blocks: exact=9423
21. 6.655 162.240 ↓ 0.0 0 1

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

22. 13.866 13.866 ↓ 1.1 60,975 1

Bitmap Index Scan on i_orders_date (cost=0.00..1,383.48 rows=54,807 width=0) (actual time=13.866..13.866 rows=60,975 loops=1)

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

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

24.          

SubPlan (forBitmap Heap Scan)

25. 0.395 529.355 ↓ 462.0 462 1

Nested Loop (cost=180,833.13..270,771.78 rows=1 width=4) (actual time=521.566..529.355 rows=462 loops=1)

  • Join Filter: ((o_1.orderid)::integer = (oi.orderid)::integer)
26. 0.709 523.416 ↑ 3.7 462 1

Hash Join (cost=180,832.57..257,067.32 rows=1,712 width=12) (actual time=521.507..523.416 rows=462 loops=1)

  • Hash Cond: ((oir.orderid)::integer = (o_1.orderid)::integer)
27. 1.683 1.683 ↑ 137.7 497 1

Index Scan using i_orderitemreserves_4_samples on orderitemreserves oir (cost=0.28..75,961.23 rows=68,447 width=8) (actual time=0.027..1.683 rows=497 loops=1)

  • Filter: ((storegroupid)::integer = 9)
  • Rows Removed by Filter: 1003
28. 55.571 521.024 ↓ 2.7 192,931 1

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

  • Buckets: 262144 (originally 131072) Batches: 1 (originally 1) Memory Usage: 8831kB
29. 250.797 465.453 ↓ 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=246.142..465.453 rows=192,931 loops=1)

  • Recheck Cond: (isinwork AND ((supplierid)::integer = 6))
  • Heap Blocks: exact=117304
30. 44.304 214.656 ↓ 0.0 0 1

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

31. 127.831 127.831 ↑ 1.0 889,385 1

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

32. 42.521 42.521 ↑ 1.0 221,729 1

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

  • Index Cond: ((supplierid)::integer = 6)
33. 5.544 5.544 ↑ 1.0 1 462

Index Scan using i_orderitems_orderitemidobjectstatusid on orderitems oi (cost=0.56..7.99 rows=1 width=8) (actual time=0.011..0.012 rows=1 loops=462)

  • Index Cond: ((orderitemid)::integer = (oir.orderitemid)::integer)
  • Filter: ((COALESCE(amountgiven, 0) = 0) AND ((oir.orderid)::integer = (orderid)::integer))
34. 4.176 4.176 ↓ 0.0 0 72

Index Scan using i_suborder_order on suborders so (cost=0.43..7.76 rows=1 width=8) (actual time=0.058..0.058 rows=0 loops=72)

  • Index Cond: ((orderid)::integer = (o.orderid)::integer)
  • Filter: ((objectstatusid <= 1) AND ((pickupstoreid)::integer = 62))
  • Rows Removed by Filter: 1
35. 0.000 0.000 ↓ 0.0 0

Index Scan using customers_pkey on customers ccu (cost=0.29..0.99 rows=1 width=16) (never executed)

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

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

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

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

38. 0.000 0.000 ↓ 0.0 0

Index Scan using contracts_pkey on contracts cso (cost=0.42..0.55 rows=1 width=8) (never executed)

  • Index Cond: ((contractid)::integer = (so.contractid)::integer)
39. 0.000 0.000 ↓ 0.0 0

Hash (cost=1.20..1.20 rows=20 width=150) (never executed)

40. 0.000 0.000 ↓ 0.0 0

Seq Scan on contracttypes csot (cost=0.00..1.20 rows=20 width=150) (never executed)

41. 0.000 0.000 ↓ 0.0 0

Index Scan using contracts_pkey on contracts co (cost=0.42..2.68 rows=1 width=26) (never executed)

  • Index Cond: ((contractid)::integer = (o.contractid)::integer)
42. 0.000 0.000 ↓ 0.0 0

Hash (cost=1.20..1.20 rows=20 width=150) (never executed)

43. 0.000 0.000 ↓ 0.0 0

Seq Scan on contracttypes ct (cost=0.00..1.20 rows=20 width=150) (never executed)

44. 0.000 0.000 ↓ 0.0 0

Hash (cost=1.05..1.05 rows=5 width=150) (never executed)

45. 0.000 0.000 ↓ 0.0 0

Seq Scan on contractpaymenttypes cpt (cost=0.00..1.05 rows=5 width=150) (never executed)

46. 0.000 0.000 ↓ 0.0 0

Index Scan using companies_pkey on companies cc (cost=0.29..0.71 rows=1 width=39) (never executed)

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

Hash (cost=1.03..1.03 rows=3 width=200) (actual time=0.017..0.017 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.005..0.007 rows=3 loops=1)

49. 0.000 0.000 ↓ 0.0 0

Index Scan using persons_pkey on persons jpcc (cost=0.42..2.78 rows=1 width=35) (never executed)

  • Index Cond: ((personid)::integer = (o.customerjpid)::integer)
50. 0.000 0.000 ↓ 0.0 0

Index Scan using companies_pkey on companies sc (cost=0.29..2.51 rows=1 width=33) (never executed)

  • Index Cond: ((companyid)::integer = (o.supplierid)::integer)
51. 0.000 0.000 ↓ 0.0 0

Index Scan using persons_pkey on persons jpsc (cost=0.42..2.78 rows=1 width=35) (never executed)

  • Index Cond: ((personid)::integer = (o.supplierjpid)::integer)
52. 0.000 0.000 ↓ 0.0 0

Hash (cost=3.10..3.10 rows=110 width=68) (never executed)

53. 0.000 0.000 ↓ 0.0 0

Seq Scan on expensesclauses ec (cost=0.00..3.10 rows=110 width=68) (never executed)

54. 0.000 0.000 ↓ 0.0 0

Index Scan using i_persons_role_10 on persons frc (cost=0.14..1.93 rows=1 width=35) (never executed)

  • Index Cond: ((personid)::integer = (o.frcid)::integer)
55. 0.000 0.000 ↓ 0.0 0

Index Scan using persons_pkey on persons sm (cost=0.42..0.85 rows=1 width=35) (never executed)

  • Index Cond: ((personid)::integer = ccu.salesid)
56. 0.000 0.000 ↓ 0.0 0

Index Scan using persons_pkey on persons sp (cost=0.42..2.78 rows=1 width=35) (never executed)

  • Index Cond: ((personid)::integer = (o.ownpersonid)::integer)
57. 0.000 0.000 ↓ 0.0 0

Hash (cost=5.42..5.42 rows=32 width=36) (never executed)

58. 0.000 0.000 ↓ 0.0 0

Hash Right Join (cost=2.78..5.42 rows=32 width=36) (never executed)

  • Hash Cond: ((srp_1.salerankid)::integer = (sr.salerankid)::integer)
59. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=1.36..3.56 rows=32 width=15) (never executed)

  • Hash Cond: ((srp_1.contractcompanyid)::integer = (cc_1.contractcompanyid)::integer)
60. 0.000 0.000 ↓ 0.0 0

Seq Scan on salerankparams srp_1 (cost=0.00..1.64 rows=64 width=19) (never executed)

61. 0.000 0.000 ↓ 0.0 0

Hash (cost=1.22..1.22 rows=11 width=4) (never executed)

62. 0.000 0.000 ↓ 0.0 0

Seq Scan on contractcompanies cc_1 (cost=0.00..1.22 rows=11 width=4) (never executed)

  • Filter: isdefault
63. 0.000 0.000 ↓ 0.0 0

Hash (cost=1.19..1.19 rows=19 width=150) (never executed)

64. 0.000 0.000 ↓ 0.0 0

Seq Scan on saleranks sr (cost=0.00..1.19 rows=19 width=150) (never executed)

Planning time : 16.590 ms
Execution time : 720.962 ms