Help understanding/troubleshooting slow queries
I'm using Filament v2 and have a table I've been trying to diagnose an issue with, which is slowness when querying the database that only occurs when using the Filament Resource/Table component with default individual column search. When I use the individual search column and supply two space-separated terms, the query is very slow. However, if I customize the search for that column and create the query manually, or if I run the slow query directly from \DB::select, the performance is great. I'm trying to figure out what would cause the slowness for this one set of conditions and I can't seem to figure it out. Any thoughts?
Query stats for the default search, default search ran from tinker/DB::select, and the customized column search.
2 Replies
I woould suggest you use Telescope and monitor the entire query process for all things ran. You may find something is running multiple queries
I have some middleware that logs every query and its execution time, which is what I had included above. The query times were crazy different for some reason and I did not figure out why. I ended up pivoting to Elastic since the dataset really needed something like that anyway.