fleetdm / fleet

Open-source platform for IT, security, and infrastructure teams. (Linux, macOS, Chrome, Windows, cloud, data center)
https://fleetdm.com
Other
2.98k stars 413 forks source link

Extremely poor DB reader performance on query #22122

Open rfairburn opened 2 weeks ago

rfairburn commented 2 weeks ago

Fleet version: v4.56.0 Web browser and operating system:


💥  Actual behavior

A DB scaled to 2x the size of the recommeded architecture went to 99.9% usage with the following query accounting for essentially all of it:

SELECT CASE ( CASE WHEN EXISTS ( SELECT 1 FROM host_mdm_apple_profiles hmap WHERE h.uuid = hmap.host_uuid AND hmap.status = 'failed' AND NOT EXISTS ( SELECT 1 FROM host_mdm_apple_profiles hmap WHERE FALSE )) THEN 'profiles_failed' WHEN EXISTS ( SELECT 1 FROM host_mdm_apple_profiles hmap
image image

🧑‍💻  Steps to reproduce

Unknown cause. Looks like mdm-related given the query.

🕯️ More info (optional)

N/A

lukeheath commented 1 week ago

Downgrading to P1 as the initial issue as been temporarily resolved.

zayhanlon commented 6 days ago

hey @gillespi314 any updates that we can share with the customer on where we are with this? thanks!

gillespi314 commented 6 days ago

@zayhanlon, there is a PR under review currently. I'm hoping that we'll get that merged tomorrow and can start load testing.