Agent Skills: Select Only Needed Columns

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

UncategorizedID: noartem/laravel-vue-skills/laravel-performance-select-columns

Install this agent skill to your local

pnpm dlx add-skill https://github.com/noartem/skills/tree/HEAD/skills/laravel-performance-select-columns

Skill Files

Browse the full folder contents for laravel-performance-select-columns.

Download Skill

Loading file tree…

skills/laravel-performance-select-columns/SKILL.md

Skill Metadata

Name
laravel-performance-select-columns
Description
Select only required columns to reduce memory and transfer costs; apply to base queries and relations

Select Only Needed Columns

Reduce payloads by selecting exact fields:

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