Filament Table Performance: Avoid One count(*) Query

preview_player
Показать описание
An interesting "investigation" we've performed based on one recent comment.
Рекомендации по теме
Комментарии
Автор

I'd like to add some more information here. The reason why we `count(*)` for bulk actions is to show the total number of records in the table on the "Select all" button (like "Select all 10, 000")

You can prevent the "Select all" button from selecting the entire table, and limit it to only being able to bulk-select one page at a time without manually clicking through each page. To do this:

danharrin
Автор

From what I'm reading and hearing about MySQL, using COUNT(*) on an InnoDB based table is attempting to use the fastest way to count rows, which is, if available, the smallest, non-null, secondary key (i.e. Not PRIMARY) on that table. It uses secondary since primary key is a clustered key with additional data, where as secondary is just "this row is here, and this one is there, etc"

So if you need to use count(*) in MySQL, you should have an additional non-null key on your table so that it can be more optimized for this

JouvaMoufette
Автор

Instead of editing the bulk actions and commenting out the code, isn't there a way to define a Boolean for that, e.g. bulkActions = false in Filament? Maybe this could be a better way to modify the code if not supported out of the box as otherwise disabling the bulk actions for one table might affect other tables that have less records and might rely on some specific bulk actions...

milenkostadinov
Автор

Why for a bulk action to count all the rows, if you can select only those that are on the page? I haven't used filament yet, so my question may seem silly.

evgenyurazovsky
Автор

How could I skip a row not to display based on one specific value?

Rattanak
Автор

I have the same with search in filament by making table field searchable and sortable filament default one

mushtaqrahimvideos
Автор

how can we make is_admin and cureently we can get (403 error forbidden) but i want a validation in only admin login page if user is_admin = 0 this will show "you are not an admin" in login page and if user is_admin = 1 we can go into dashboard how can we archive this functionallity? please let me know.

devkumarverma
Автор

Hi sir, how to define custom meta tags in filament all pages. And also how make only edit page instead of resource

codingwith-rk