Openbravo Issue Tracking System - Retail Modules
View Issue Details
0037633Retail ModulesWeb POSpublic2018-01-14 09:512018-02-22 18:19
umartirena 
rqueralta 
normalmajoralways
closedno change required 
5
 
 
marvintm
No
0037633: Search a Business Partner by 'Phone' in 'Remote for Customer' mode raises a JS error with a big amount of customers
Search a Business Partner by 'Phone' in 'Remote for Customer' mode raises a JS error with a big amount of customers.

We are trying with 1702935 Customers.

The following query in psql takes around 6 minutes with that amount of Customers. (Replace the proper ID's)

select businesspa0_.C_BPartner_ID as col_0_0_, businesspa0_.Customer_Blocking as col_1_0_, businesspa0_.SO_Order_Blocking as col_2_0_, businesspa0_.Name as col_3_0_, businesspa0_.TaxID as col_4_0_, businesspa2_.Name as col_5_0_, aduserlist1_.Email as col_6_0_, aduserlist1_.Phone as col_7_0_, businesspa0_.C_BPartner_ID as col_8_0_, '' as col_9_0_, '' as col_10_0_, '' as col_11_0_, '' as col_12_0_, '' as col_13_0_, '' as col_14_0_ from C_BPartner businesspa0_ left outer join AD_User aduserlist1_ on businesspa0_.C_BPartner_ID=aduserlist1_.C_BPartner_ID, C_BP_Group businesspa2_ where businesspa0_.C_BP_Group_ID=businesspa2_.C_BP_Group_ID and (upper(aduserlist1_.Phone) like upper('609%')) and businesspa0_.IsCustomer='Y' and (businesspa0_.M_PriceList_ID is not null) and (businesspa0_.AD_Client_ID in ('7CA9E072466D4B5F835216EFE75892FA' , '0')) and (businesspa0_.AD_Org_ID in ('0' , '95A8BA076D91431490E60AEFE687F544' , '478D26D062E44903830501196588BB21' , '0308CDA931C6482396877288662D3092' , '502853F6F6794AA88710EC1E976ED54B')) and businesspa0_.IsActive='Y' order by businesspa0_.Name asc limit 301
Adding the following index in ad_user table increases the speed of the query to 18 seconds, but still not enough:

CREATE INDEX ad_user_phone_idx
  ON ad_user
  USING btree
  (phone COLLATE pg_catalog."default");
Performance
png Selection_124.png (360,408) 2018-01-14 09:51
https://issues.openbravo.com/file_download.php?file_id=11457&type=bug
Issue History
2018-01-14 09:51umartirenaNew Issue
2018-01-14 09:51umartirenaAssigned To => Retail
2018-01-14 09:51umartirenaFile Added: Selection_124.png
2018-01-14 09:51umartirenaTriggers an Emergency Pack => No
2018-01-14 09:52umartirenaResolution time => 1516316400
2018-01-14 09:58umartirenaProposed Solution updated
2018-01-16 08:35marvintmResolution time1516316400 => 1517180400
2018-01-19 14:05SandrahuguetTag Attached: Performance
2018-01-25 13:21marvintmResolution time1517180400 => 1518303600
2018-01-25 16:53rqueraltaAssigned ToRetail => rqueralta
2018-01-25 16:54rqueraltaStatusnew => scheduled
2018-02-15 19:07hgbotCheckin
2018-02-15 19:07hgbotNote Added: 0102453
2018-02-15 19:07hgbotStatusscheduled => resolved
2018-02-15 19:07hgbotResolutionopen => fixed
2018-02-15 19:07hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/8d0fbb9abd2e45d9ad682e6efdf12fdf1da38239 [^]
2018-02-15 19:11marvintmReview Assigned To => marvintm
2018-02-15 19:11marvintmStatusresolved => closed
2018-02-15 19:11marvintmFixed in Version => RR18Q2
2018-02-16 12:22shuehnerNote Added: 0102459
2018-02-16 12:22shuehnerStatusclosed => new
2018-02-16 12:22shuehnerResolutionfixed => open
2018-02-16 12:22shuehnerFixed in VersionRR18Q2 =>
2018-02-16 14:15hgbotCheckin
2018-02-16 14:15hgbotNote Added: 0102464
2018-02-16 14:21marvintmNote Added: 0102465
2018-02-16 14:21marvintmStatusnew => closed
2018-02-16 14:21marvintmResolutionopen => no change required
2018-02-22 18:19hudsonbotCheckin
2018-02-22 18:19hudsonbotNote Added: 0102771
2018-02-22 18:19hudsonbotCheckin
2018-02-22 18:19hudsonbotNote Added: 0102774

Notes
(0102453)
hgbot   
2018-02-15 19:07   
Repository: erp/devel/pi
Changeset: 8d0fbb9abd2e45d9ad682e6efdf12fdf1da38239
Author: Rafael Queralta Pozo <rqueralta <at> nauta.cu>
Date: Thu Jan 25 12:46:30 2018 -0500
URL: http://code.openbravo.com/erp/devel/pi/rev/8d0fbb9abd2e45d9ad682e6efdf12fdf1da38239 [^]

Fixed issue 37633: Search a Business Partner by 'Phone' in 'Remote for Customer'
mode raises a JS error with a big amount of customers

- Added index into ad_user table

---
M src-db/database/model/tables/AD_USER.xml
---
(0102459)
shuehner   
2018-02-16 12:22   
Reopening as that index as is seems not correct for that query + is missing other important things:

a.) phone: That is an optional field probably not even filled in in many cases -> probably should be partial index
b.) the query uses upper in where clause the index does not -> it will not be used
c.) The query uses startswith search the index does not take that into again again it will not be used
(0102464)
hgbot   
2018-02-16 14:15   
Repository: erp/devel/pi
Changeset: 0f81468c4048d86f0e609a2fb7326bc62e19181a
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Fri Feb 16 14:15:32 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/0f81468c4048d86f0e609a2fb7326bc62e19181a [^]

Related to issue 37633. Removed unneeded index

---
M src-db/database/model/tables/AD_USER.xml
---
(0102465)
marvintm   
2018-02-16 14:21   
After further discussion, we have decided not to do any change for this issue. The affected customer has a custom index which works for them, and we don't want to include an index which probably won't be useful for the majority of customers, and will add some overhead to all of them.
(0102771)
hudsonbot   
2018-02-22 18:19   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/980a6ad5bbf5 [^]
Maturity status: Test
(0102774)
hudsonbot   
2018-02-22 18:19   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/980a6ad5bbf5 [^]
Maturity status: Test