Saved Searches are powerful, but when dealing with large datasets, performance issues arise. This article covers best practices to optimize Saved Searches for faster reporting.
Optimization Techniques
- Use Indexed Fields in Criteria
- Filtering on indexed fields (like
internalid,datecreated) speeds up queries.
- Minimize Use of Joins
- Avoid excessive joins (
Created From,Parent Transaction), as they slow down searches.
- Limit Results & Avoid Sorting Large Datasets
- Use
Results Limitand avoid sorting on non-indexed fields.
- Use Summary Fields Instead of Multiple Filters
- Example: Instead of multiple criteria, use
SUMorCOUNTin summary types to reduce calculations.
- Script-Driven Optimization for Large Reports
- If Saved Searches are slow, use SuiteScript to batch process data:
javascript
Copy
Edit
define(['N/search'], function(search) {
function runOptimizedSearch() {
var savedSearch = search.load({ id: 'customsearch_large_data' });
savedSearch.run().each(function(result) {
log.debug({ title: 'Record ID', details: result.getValue({ name: 'internalid' }) });
return true;
});
}
return { execute: runOptimizedSearch };
});
By following these techniques, users can enhance the performance of their NetSuite reports, ensuring real-time data retrieval without performance degradation.