PostgreSQL Heroku Heroku Postgres Node.js Knex.js
Last week we rolled out a simple patch that decimated the response time of a Postgres query crucial to Checkly. It quite literally went from an average of ~100ms with peaks to 1 second to a steady 1ms to 10ms.
However, that patch was just the last step of a longer journey:
I looked at what API endpoints were using which queries and how their response time grew over time. Specifically the customer facing API endpoints that are directly responsible for rendering the first dashboard page of the product are crucial.
I looked at the Heroku metrics such as those reported by
heroku pg:outlier
and cross references that with "slowest response time" statistics.I reproduced the production situation as best as possible on a local development machine and test my hypothesis that an composite index on a
uuid
field and atimestampz
field would reduce response times.
This method secured the victory and we rolled out a new index last week. Response times plummeted. Read the full story in the blog post.