FOUR-33159 POC Performance issue when opening the column configuration in a saved search - #9061
devmiguelangel wants to merge 7 commits into
Conversation
…eryService for improved variable handling
PR SummaryMedium Risk Overview
Adds Feature tests cover fulltext saved searches with empty process IDs, multi-page Reviewed by Cursor Bugbot for commit c171a6e. Bugbot is set up for automated code reviews on this repo. Configure here. |
…g pagination and variable filtering scenarios
…rameter for improved variable handling
…and error handling
|





Issue & Reproduction Steps
FOUR-33159 POC Performance issue when opening the column configuration in a saved search
Problem
Opening Columns on a Request Saved Search with fulltext PMQL (e.g.
(fulltext LIKE "%test%")) took ~76s and could 500 with MySQL error 1038 (Out of sort memory).Two independent bottlenecks were hit on every load:
HasDataColumns::getData()re-executed the full Saved Search PMQL (includingLOWER(data) LIKE '%test%') just to sample recentdataJSON for column names.SavedSearch::getProcessesAttribute()fell back toProcess::get()(all processes) and then ran a recursiveExportManagerscreen walk per process, adding ~50s of PHP.Solution
Column discovery no longer depends on the user's PMQL or on
sort_buffer_size.HasDataColumns::getData()now usescolumn_discovery_query(type base query, optionally scoped byprocess_id), orders by indexedid DESC, and limits to 10 rows. The fulltext clause is never applied. MySQL 1038 is caught and returns an empty sample instead of a 500.ProcessVariableDiscoveryServiceresolvesdata.*fields fromvar_finder_variables(indexed) for both scoped and unscoped searches. Screen fallback usesScreensInProcess(direct BPMNscreenRefscan) capped to the 25 most recently updated processes, not the recursive export graph.GET /api/1.1/processes/variables?onlyAvailable=now paginates Saved Search available + data columns independently. Process variables load in a second phase. EmptyprocessIdsreturns the unscoped catalog instead of an empty page. Active columns are excluded in SQL. Fixed a duplicatepaginate()call in the controller.Cache::flexible+ lock + last-known-good for both the discovery service anddata_columns, keyed on saved search / process / Variable Finder state.VariablesList.vuepages available columns untilmeta.last_page, then switches to process variables. The edit screen no longer background-fetches every page.Scope
scopeFilter()/valueAliasFullText()are untouched.Related Tickets & Packages
https://processmaker.atlassian.net/browse/FOUR-33159
https://github.com/ProcessMaker/package-savedsearch/pull/696
Code Review Checklist
ci:package-savedsearch:FOUR-33159
.