Pushpraj Singh Jadon created OFBIZ-13366:
--------------------------------------------

             Summary: Refactor Entity Find Logic to Use Limit and Offset for 
Scalable Data Retrieval
                 Key: OFBIZ-13366
                 URL: https://issues.apache.org/jira/browse/OFBIZ-13366
             Project: OFBiz
          Issue Type: Improvement
          Components: webtools
            Reporter: Pushpraj Singh Jadon


h2. Problem Statement

Currently, the {{FindGeneric.groovy}} script is responsible for retrieving data 
for entity views. However, its existing data-fetching approach becomes 
inefficient when working with large datasets.

When entities contain millions of records, the current pagination mechanism may 
load a significantly larger number of records into memory than required. In 
some cases, the system retrieves most—or all—records before applying pagination 
logic in memory.

For example, when a user requests to view only the last 20 records, the system 
may still load a much larger dataset into memory before filtering the results 
for display. This leads to unnecessary memory consumption and performance 
degradation.
h2. Proposed Solution

Refactor the data retrieval logic in the following script:
framework/webtools/groovyScripts/entity/FindGeneric.groovy
 
The refactoring will be used explicitly {{EntityFindOptions}} with proper 
{{limit}} and {{offset}} values. By pushing pagination logic down to the 
database layer, only the records required for the current view will be fetched.
h2. Benefits
 * *Reduced Memory Usage*
Only the records required for the current page are loaded into memory.

 * *Improved Performance*
Faster response times when working with large entities, as pagination is 
handled directly by the database.

 * *Improved Scalability*
Enables Webtools to efficiently manage entities containing millions of records 
without excessive resource consumption or risk of memory issues.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to