F
Filament7mo ago
harps

Large json columns

I have a table with some large json columns and it's slowing down a resource table from loading and I don't show them on the table. How do I exclude those columns from the resource query?
4 Replies
harps
harps7mo ago
I think I worked this out, rather than exclude I need to modify the table query to only include what aI want.
->modifyQueryUsing(fn (Builder $query) => $query->select(
'id',
'type',
'asset_label',
'start_point',
'status',
'batch_id',
'assigned_to_id',
'region',
'created_at',
'exported',
));
->modifyQueryUsing(fn (Builder $query) => $query->select(
'id',
'type',
'asset_label',
'start_point',
'status',
'batch_id',
'assigned_to_id',
'region',
'created_at',
'exported',
));
toeknee
toeknee7mo ago
I would say that's good, but maybe look to loop through the columns within the schema that are visible and just render them. As the above is more overhead if you add a column in 6 months and forget.
harps
harps7mo ago
Hi @toeknee, These are the only fields I need in the table. Which form are you referring to? In my case it was actually better to create a global scope as I only needed the json objects at very specific points in the application such as viewing a resource.
toeknee
toeknee7mo ago
Perfect