Openbravo Issue Tracking System - POS2
View Issue Details
0058073POS2Fashionpublic2025-02-25 14:232025-03-11 11:05
sofidossant 
caristu 
highmajoralways
closedfixed 
5
pi 
 
approved
alostale
OBPS
122020
No
0058073: Performance: Slowness loading the Product window using the Openbravo Retail fashion module
Getting results on the grid of the Product window takes long having thousands of Products and when using the REtail fashion module, and showing the 3 property filed related to color, size and season.


Analyzing the query executed by the grid it is fast (few ms) but the grid takes long to show.

By debugging the code, we can see that a lot of queries are done after the query is finished to show information on the grid.
The query is the following:

https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo/-/blob/master/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/materialmgmt/RelevantCharacteristicAdditionalPropertyResolver.java#L81 [^]


There are 1632677 rows in ad_tree_node, and the query tools 300ms to finish, and the query is executed for all the results of the grid, so it takes longer to finish and show the data.
- On an environment with the retails fashion installed and a big number of records in the ad_treenode table
- Have characteristics and show the color, size and season table
- Open the product window

It takes seconds to show the data

CREATE INDEX IF NOT EXISTS ad_treenode_nodeid
    ON public.ad_treenode USING btree
    (node_id COLLATE pg_catalog."default" ASC NULLS LAST)
    TABLESPACE pg_default;
Performance
depends on backport 005819625Q1.1 closed caristu Performance: Slowness loading the Product window using the Openbravo Retail fashion module 
depends on backport 005819724Q4.2 closed caristu Performance: Slowness loading the Product window using the Openbravo Retail fashion module 
? sqlformatter.sql (8,964) 2025-02-25 17:41
https://issues-new.openbravo.com/file_download.php?file_id=20965&type=bug
Issue History
2025-02-25 14:23sofidossantNew Issue
2025-02-25 14:23sofidossantAssigned To => Retail
2025-02-25 14:23sofidossantOBNetwork customer => OBPS
2025-02-25 14:23sofidossantSupport ticket => 122020
2025-02-25 14:23sofidossantTriggers an Emergency Pack => No
2025-02-25 14:32PracticsIssue Monitored: Practics
2025-02-25 15:08aaroncaleroNote Added: 0176115
2025-02-25 15:08aaroncaleroAssigned ToRetail => sofidossant
2025-02-25 15:08aaroncaleroStatusnew => feedback
2025-02-25 16:22sofidossantNote Added: 0176124
2025-02-25 16:22sofidossantStatusfeedback => new
2025-02-25 16:56aaroncaleroNote Added: 0176128
2025-02-25 16:56aaroncaleroStatusnew => feedback
2025-02-25 17:41sofidossantNote Added: 0176130
2025-02-25 17:41sofidossantFile Added: sqlformatter.sql
2025-02-25 17:42sofidossantStatusfeedback => new
2025-02-26 11:12sofidossantNote Added: 0176145
2025-03-03 14:05egoitzAssigned Tosofidossant => aaroncalero
2025-03-04 16:29aaroncaleroNote Added: 0176446
2025-03-04 16:29aaroncaleroStatusnew => closed
2025-03-04 16:29aaroncaleroResolutionopen => no change required
2025-03-06 09:14egoitzSummaryPERFORMANCE with the module Retail Fashion => Performance: Slowness loading the Product window using the Openbravo Retail fashion module
2025-03-06 09:14egoitzDescription Updatedbug_revision_view_page.php?rev_id=29305#r29305
2025-03-06 09:14egoitzSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=29307#r29307
2025-03-06 09:14egoitzProposed Solution updated
2025-03-06 09:14egoitzAssigned Toaaroncalero => caristu
2025-03-06 09:14egoitzStatusclosed => new
2025-03-06 09:14egoitzResolutionno change required => open
2025-03-06 09:14egoitzNote Deleted: 0176115
2025-03-06 09:14egoitzNote Deleted: 0176124
2025-03-06 09:14egoitzNote Deleted: 0176128
2025-03-06 09:14egoitzNote Deleted: 0176130
2025-03-06 09:14egoitzNote Deleted: 0176145
2025-03-06 09:14egoitzNote Deleted: 0176446
2025-03-06 09:56hgbotMerge Request Status => open
2025-03-06 09:56hgbotNote Added: 0176517
2025-03-06 10:28caristuSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=29310#r29310
2025-03-10 11:17hgbotMerge Request Statusopen => approved
2025-03-10 12:55caristuRelationship addedrelated to 0057924
2025-03-10 16:11hgbotNote Added: 0176622
2025-03-10 16:11hgbotResolutionopen => fixed
2025-03-10 16:11hgbotStatusnew => closed
2025-03-10 16:11hgbotFixed in Version => PR25Q2
2025-03-10 16:11hgbotNote Added: 0176623
2025-03-10 17:09hgbotNote Added: 0176626
2025-03-11 10:36hgbotNote Added: 0176648
2025-03-11 10:36hgbotNote Added: 0176649
2025-03-11 10:41caristuStatusclosed => new
2025-03-11 10:41caristuResolutionfixed => open
2025-03-11 10:41caristuFixed in VersionPR25Q2 =>
2025-03-11 10:42caristuStatusnew => scheduled
2025-03-11 10:42caristuRelationship deletedrelated to 0057924
2025-03-11 11:04caristuStatusscheduled => resolved
2025-03-11 11:04caristuResolutionopen => fixed
2025-03-11 11:04caristuReview Assigned To => alostale
2025-03-11 11:04caristuStatusresolved => closed
2025-03-11 11:05caristuTag Attached: Performance

Notes
(0176517)
hgbot   
2025-03-06 09:56   
Merge Request created: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo/-/merge_requests/1572 [^]
(0176622)
hgbot   
2025-03-10 16:11   
Merge request merged: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo/-/merge_requests/1572 [^]
(0176623)
hgbot   
2025-03-10 16:11   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo [^]
Changeset: 06aec5a6d2dc98c75bc71393890bc42c255357a5
Author: Carlos Aristu <c.aristu@orisha.com>
Date: 10-03-2025 15:08:44
URL: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo/-/commit/06aec5a6d2dc98c75bc71393890bc42c255357a5 [^]

fixes BUG-58073: slow calc of prod char fields with many records in ad_trenode

---
M src-db/database/model/tables/AD_TREENODE.xml
---
(0176626)
hgbot   
2025-03-10 17:09   
Merge Request created: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo/-/merge_requests/1576 [^]
(0176648)
hgbot   
2025-03-11 10:36   
Merge request merged: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo/-/merge_requests/1576 [^]
(0176649)
hgbot   
2025-03-11 10:36   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo [^]
Changeset: 6ec50b04d6d12ae4d8af2209c892aaa8ad949bb7
Author: Carlos Aristu <c.aristu@orisha.com>
Date: 11-03-2025 09:36:32
URL: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo/-/commit/6ec50b04d6d12ae4d8af2209c892aaa8ad949bb7 [^]

fixes BUG-58073: slow calc of prod char fields with many records in ad_trenode

  By modifying the existing query to filter by AD_TREE_ID also, an index scan is done using the existing `AD_TREENODE_TREE_NODE_UN` unique constraint. With this fix we can avoid the creation of the index only by node_id that we did to fix originally the issue. So we are removing that index with this changeset also.

---
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/materialmgmt/RelevantCharacteristicAdditionalPropertyResolver.java
M src-db/database/model/tables/AD_TREENODE.xml
---