You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Optimize SQL queries with (materialized?) view #1589
Polling is a common part of both Concourse's UI and internal things like garbage collection. In a stable state, a lot of things that we're polling aren't changing, but the query to poll for them is expensive (ish).
One example is the pipeline view: every 5 seconds, we get the latest completed build and nextmost started/pending build for each job. This query is nontrivial and has a lot of impact on the user, as it determines the speed of the pipeline UI. As part of the dashboard work, a third query was added, for the current "transitional" build (the first build that got the job in its current state), which is even more expensive to compute.
Similarly, garbage collection entails finding the latest completed build of each job, to know which builds can be marked non-interceptible.
One problem is expressiveness: we repeat the same logic in a few different contexts, and it's not immediately clear, as it's just SQL embedded in SQL.
Another problem is efficiency: it's pretty silly to be causing so much load and being so slow when really the data only changes when e.g. a build runs.
A Modest Proposal
To solve the first problem of expressiveness, we can start using VIEWs. This allows us to at least give the query a name, simplify each query, and make it easier to see patterns among our queries.
To solve the second problem, we can transition these to MATERIALIZED VIEW, and do a REFRESH MATERIALIZED VIEW CONCURRENTLY when the data set changes. This will make the reads much quicker.
Activity
[-]optimize sql queries with view (materialized?)[/-][+]Optimize SQL queries with (materialized?) view[/+]optimize dashboard via materlialized views
bump atc
vito commentedon Oct 26, 2017
Done! We observed significant performance improvement on Wings.
bump etree tsa handlers mux clockwork goxmldsig genproto grpc