What is Overheating?
- Queries overheat when they discard too many invalid results before finding enough valid results.
When Phabricator executes a query, it loads raw results (matching the query constraints) from the database and then filters them, discarding results which are invalid or which the viewer doesn't have permission to see. If it spends too long discarding invalid results without finding enough valid results to satisfy the request, the query "overheats" and fails (usually returning any results it has found so far).
This prevents performance issues when a query matches a very large number of raw results but only a small number are valid or visible to the viewer.
For example: if an install has 10,000,000 commits and a viewer can only see 7 of them, the "Browse Commits" page in Diffusion will overheat. If it did not, it would need to examine and filter all 10,000,000 commits to determine that the viewer can not see a full page of results. This could take a very long time (minutes or hours), so the query overheats after examining a subset of the rows.
Fixing Overheated Queries
- Fix overheated queries by adding more constraints, so they match fewer invalid results.
If a query you are running is overheating, you can usually fix it by adding more constraints to the query. Your goal is to add constraints which exclude most of the invalid results before filtering is applied, so Phabricator doesn't need to spend time examining them.
In the example above, if a viewer can only see a few repositories, adding a "Repositories: X, Y, Z" constraint to the "Browse Commits" query will reduce the number of invalid results the query must examine and discard, and likely stop the query from overheating.
For a more detailed technical discussion of the overheating mechanism, see: T13133: Phabricator Query Layer Overview
This task is the target of: Overheated Queries