Way to Optimize Navigation badges counts

I have a query that get the count of a model for each resource in Filament. It's taking to much time now since there is so much data. is there a good way to get it without using the cache?
Screenshot_2025-07-11_at_2.50.18_PM.png
Solution
Ensure you've got your database indexes optimised, and count really shouldn't be taking any time at all.

You could use a persistent view within your database structure to store your counts...but really modern databases don't need these workarounds.
Was this page helpful?