F
Filament8mo ago
suluap

optimizing queries

I have 1 million records and increasing day by day. I am using the eloquent query builder to display the records on the front end but they are loading extremely slow to the point that they timeout and give an error. Please assist with this regard
4 Replies
Oidt
Oidt8mo ago
How? No info given here how can people help?
krekas
krekas8mo ago
Filament Daily
YouTube
Filament Performance: 1M DB Rows - Benchmark
Let's test if Filament is slower with larger amount of data, and discuss the SQL queries under the hood. Links mentioned in the video: - Official Filament Demo on GitHub: https://github.com/filamentphp/demo - SQL dump of the database shown in the video: https://drive.google.com/file/d/1P284fqu8LYmsqPOrnXfYlAIfL1xIENxg/view?usp=sharing - Filamen...
ModestasV
ModestasV8mo ago
This is a very complicated topic and there is no one-solution that would help. Reason for this - you have to dig deeper and see what exactly makes it slow. As mentioned in the FilamentDaily video - we have worked on a lot of debugging before coming to conclusion - specific indexes were required. But not too many of them, just a right amount to make it fast 🙂
tim.lalev
tim.lalev8mo ago
I had a case where the query alone was not that slow but the rendering of the panel was performing very poorly around at 1M rows. Model had a bunch of relationships and table had 60 fields and few of them ware big json structures. What worked for me was loading just the bare minimum columns initially and then lazy load additional info as needed in expandable/collapsable panels or modals with custom livewire components fetching data as needed. I'm now at 13M records and it still feels fast.

Did you find this page helpful?