Claude
Skills
Sign in
Back

laravel-performance-select-columns

Included with Lifetime
$97 forever

Select only required columns to reduce memory and transfer costs; apply to base queries and relations

General

What this skill does


# Select Only Needed Columns

Reduce payloads by selecting exact fields:

```php
User::select(['id', 'name'])->paginate();

Post::with(['author:id,name'])->select(['id','author_id','title'])->get();
```

- Avoid `*`; keep DTOs/resources aligned with selected fields
- Combine with eager loading to avoid N+1

Related in General