Custom Admin grids expose database costs
Custom Admin grids and reports are easy to build and easy to make slow. A grid that loads a large dataset, or a report that aggregates years of data live, can take seconds to render and run an expensive database query each time.
The Admin has no full-page cache, so the request pays that cost every time someone opens the page. Staff wait, the database works hard, and a report that was never optimized slows the store again and again.
This article explains the patterns that make custom grids and reports slow, then connects each pattern to a practical fix.

Unpaginated collections grow until requests time out
In Magento, a collection represents the rows a query will return. The most common mistake is loading the entire collection at once instead of using pagination.
Pagination splits the result into pages and loads the rows needed for the current page. Without it, the query and PHP process handle more data as the catalog or order history grows.
This often works on a small dataset, which is why the code passes its first test. Later, the same grid can crawl in production or time out. A grid should never load a hundred thousand rows to display fifty.
Unindexed filters force full table scans
Grid filters generate database queries. An index gives the database a faster path to matching rows. Without an index on a filtered column, the database may perform a full table scan and read every row.
Every filter or sort on that column can repeat the scan. The cost grows with the table, so a query that was acceptable on a test database can become slow on production data.
Profile the query behind the grid. Add indexes to the columns used for filtering and sorting when the query plan shows that the database needs them.
Joins can make a collection expensive
A join combines rows from related database tables so one grid can display related data. Each join adds work to the query. Joins across large tables can make the query expensive.
Some joins remain after development even though the grid does not display the related data. Remove joins and selected columns the grid does not use. A smaller collection gives the database less work.
Read the actual query the grid generates. If it joins tables whose columns never appear in the grid, the collection is doing work with no visible result.
Live reports repeat expensive grouping queries
Reports are heavier than many grids because they summarize data. A report that aggregates orders or sales across years runs a large grouping query each time it loads.
Grouping means collecting many rows into totals or categories. Running that work live asks the database to scan and group a large dataset on every view.
Precompute the result when the report does not need second-by-second data. Aggregate the data on a schedule into a summary table, then read the summary table in the Admin. That turns a heavy live query into a faster lookup.
Large reports can exhaust the PHP memory limit
A report can exhaust the PHP memory limit when it builds a large result set in memory. Gathering rows into one array, especially for an export, can trigger a fatal memory error during the request.
A report that works on one year of data and fails on five years has outgrown its memory allocation. Raising the limit may delay the failure, but the report will hit the same limit again as the dataset grows.
Process the data in batches or use streaming output. Batches handle a smaller set at a time. Streaming sends results as they are produced instead of keeping the full report in memory.
Large exports should not run in one request
A synchronous export keeps the work inside the user's web request. It loads the full dataset, holds it in memory, and tries to create the file before the request timeout.
A large export can exceed the web server timeout after doing most of the work. The user sees an error and may retry, which creates the same load again.
Asynchronous export moves the work to a background process. The process creates the file without making the user wait for one long request. Use this pattern for any export large enough to risk a timeout.
Fix the cause and keep the feature
Each fix should match a specific cause. Use pagination for large collections, indexes for query filters, trimmed collections for unnecessary joins, precomputed aggregates for repeated reports, and asynchronous exports for long-running file creation.
Start with profiling. Read the query the grid or report generates. Then determine whether the cost comes from collection size, filters, joins, grouping, memory use, or request duration.
This is query-first discipline applied to the Admin. The Admin makes the cost easier to see because it has no full-page cache.
Fast Admin tools start with query-first work
Custom Admin grids and reports are staff tools. Slow tools cost staff time every day, and their performance usually connects to a database query, PHP memory use, or request duration.
Find which grids and reports are slow, identify the resource they consume, and fix that specific cause. Profiling these Admin tools is a practical part of a performance review.