During a migration from a legacy system to a new platform, I brought analytics API response times down from around 30 seconds to roughly 2. Other endpoints across the platform became faster too.
The analytics endpoints aggregated data across the system, including data organised in a tree structure. The migration gave me an opportunity to revisit how that data was stored, prepared, and queried.
I started by auditing the existing database and designing a new schema with clearer relationships and indexes aligned with how the application accessed the data.
I also built an ETL service from scratch to transform the legacy data into the structure the new platform needed. The new model supported analytics and made the data easier to prepare for AI use cases and vector indexing.
At the API layer, I reworked the analytics queries, using raw SQL where I needed more control over how hierarchical data was retrieved and aggregated. Together, the schema, indexing, ETL, and query changes delivered the performance improvements.
When you investigate a slow endpoint, how often does it lead you back to the data model?