Skip to content

feat(FOUR-32405): add Database Indexes to Improve Saved Searches Performance - #8940

Open
rodriquelca wants to merge 1 commit into
developfrom
feature/FOUR-32405
Open

feat(FOUR-32405): add Database Indexes to Improve Saved Searches Performance#8940
rodriquelca wants to merge 1 commit into
developfrom
feature/FOUR-32405

Conversation

@rodriquelca

Copy link
Copy Markdown
Contributor

Issue & Reproduction Steps

Saved Search queries slow down on large datasets because process_request_tokens and related tables lack indexes for common filter columns.

Repro:

  • Run a Saved Search filter on a large instance.
  • EXPLAIN the query → full table scan or filesort.
  • Response time exceeds acceptable thresholds.

Solution

  • Added database/migrations/2026_07_27_000000_add_saved_search_indexes.php.
  • Added composite indexes on process_request_tokens, category_assignments, process_versions, processes, and process_categories.
  • Optimized column order by removing redundant id columns from the middle of composites.
  • Made up() idempotent and down() tolerant to foreign-key constraints.

How to Test

php artisan migrate --path=database/migrations/2026_07_27_000000_add_saved_search_indexes.php

Related Tickets & Packages

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

@processmaker-sonarqube

Copy link
Copy Markdown

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@mireyacaro mireyacaro left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants