-
Notifications
You must be signed in to change notification settings - Fork 843
dead rows accumulate in software_host_counts #35805
Copy link
Copy link
Closed
Labels
#g-security-complianceSecurity & Compliance product groupSecurity & Compliance product group:releaseReady to write code. Scheduled in a release. See "Making changes" in handbook.Ready to write code. Scheduled in a release. See "Making changes" in handbook.bugSomething isn't working as documentedSomething isn't working as documented~aging bugBug has been open more than 90 daysBug has been open more than 90 days
Milestone
Metadata
Metadata
Labels
#g-security-complianceSecurity & Compliance product groupSecurity & Compliance product group:releaseReady to write code. Scheduled in a release. See "Making changes" in handbook.Ready to write code. Scheduled in a release. See "Making changes" in handbook.bugSomething isn't working as documentedSomething isn't working as documented~aging bugBug has been open more than 90 daysBug has been open more than 90 days
Type
Projects
Status
Done
Fleet version:
4.76.0
Web browser and operating system:
💥 Actual behavior
Dogfood (and customer DBs) accumulate dead rows in software_host_counts when software is updated or removed in a team.
Running the following query on Dogfood:
Results in:
🛠️ To fix
Proposed:
Clean up all rows with hosts_count = 0
OR
Never have rows with hosts_count=0 in that table in the first place. This will allow us to optimize queries that currently have to do an inefficient
hosts_count > 0when querying this table. For example, just like we do with vulnerabilities, instead of updating the existing table during vulnerabilities run, we can create a new software_host_counts table and swap out the old one.🧑💻 Steps to reproduce
🕯️ More info (optional)
One way we could be accumulating dead rows:
Scenario:
Then:
Cleanup runs: