Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Add missing index to Postgresql database to resolve high CPU usage #3995
There is a missing index which would have
This causes high load for the concurse database.
Steps to Reproduce
Create a pipeline, trigger many builds, have >1M rows in the versioned_resources table for a single pipeline.
Concourse/Postresql have low CPU usage.
Concourse/Postresql have high CPU usage.
See a detailed overview, analysis and a proposed solution in https://discuss.concourse-ci.org/t/concourse-db-high-cpu-load-80-90-all-time/754/8
Note that there need to be two different versions of the index, depending on the version of Postresql.
One index with INCLUDE'd column which is more optimal, for PostreSQL 11.x, and a different one for PostgreSQL 10.x, because the INCLUDE’d columns in an index are only supported on PostgreSQL v11+. I've explained in in the above post as well.