fleet/server/datastore
Victor Lyuboslavsky 73b629ee1b
Optimized GetHostScriptExecutionResults MySQL query for for large numbers of script results. (#32595)
Fixes #32295 

The issue was identified/fixed using this performance test:
https://gist.github.com/getvictor/b289b7b14981fb7bf77e57c80af117d1

With the fix:
  - 100 records: 2.6ms (similar)
  - 1,000 records: ~7ms (32x faster)
  - 5,000 records: ~10ms (530x faster)
  - 10,000 records: 13ms (1,430x faster)
  - 20,000 records: ~25ms (2,960x faster)
  - 40,000 records: 50ms (6,000x faster)


# Checklist for submitter

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files)
for more information.

## Testing

- [x] QA'd all new/changed functionality manually

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- New Features
- Script details now surface the most relevant “latest” status per
script, prioritizing upcoming executions when present.
- Performance Improvements
- Significantly faster loading of host script results and script
details, especially at large scale.
  - Improved responsiveness when filtering/sorting script results.
- Documentation
- Added changelog entry describing the optimization to script results
handling.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-09-04 15:48:18 -05:00
..
cached_mysql Allow configuring webhook policy automations for "No team" (#32129) 2025-08-28 16:38:27 -05:00
filesystem Added signed URLs (#25197) 2025-01-09 12:56:54 -06:00
mysql Optimized GetHostScriptExecutionResults MySQL query for for large numbers of script results. (#32595) 2025-09-04 15:48:18 -05:00
mysqlredis Refactor EnrollOrbit/EnrollHost (#30872) 2025-07-15 17:22:02 -03:00
redis Feat 1817 add iam auth to mysql and redis (#32488) 2025-09-04 10:08:47 -05:00
s3 Feat: Perform S3 Uploads with Upload Manager (#32010) 2025-08-20 15:20:53 -04:00