spotify / XCMetrics

XCMetrics is the easiest way to collect Xcode build metrics and improve developer productivity.
https://xcmetrics.io
Other
1.1k stars 77 forks source link

Add Indexes to table, optimise query and add new endpoint #21

Closed ecamacho closed 3 years ago

ecamacho commented 3 years ago

As we collect more data, we started to have some slow queries. This PR addresses this issue:

  1. Creates indexes for build_identifier, target_identifier and step_identifier.
  2. Optimises the query that fetches the list of Target that belong to a build by using the full table name partition.

These changes resulted in the v1/build/info endpoint to return data in less than a second in our internal installation, before the changes it was taking 60 secs.

Additionally, adds an endpoint to fetch the list of Step that belong to a Target, that uses the same technique of using an index plus the full table name for the query. Before doing this change it was almost impossible to make a query to our Step table, because it was taken like 10 mins.