Skip to content

Success story.

From 21 seconds to 357 milliseconds: a customer portal that responds in real time

A payment processing company pays merchants based on their transactions. It migrated this cycle to AWS and was consulting with Amazon Athena, but its customer portal needed immediate answers, and with so much aggregated data, Athena wasn't enough.

optimizacion de consultas

We take on any challenge

At Zenta there are no obstacles we cannot overcome.

  • Challenge

    Complex queries took an average of 21 seconds, too long for a private customer portal. The goal: to respond in 1 or 2 seconds at most, in real time and, if possible, without preprocessing or materialized views.

  • Solution

    We optimized the table logic: we configured composite distribution and sort keys that order the data according to how it is queried, and we applied automatic column compression to reduce the disk read load. In practice, the work began by understanding how the portal queries data: what filters it uses, what fields it groups data by, and what time periods it checks most frequently. With this analysis, we defined distribution keys, which distribute the data so that each query works in parallel, and composite sort keys, which store the records in the same order in which they are searched. Automatic column compression reduces the amount of data read from disk with each query. Solution components: Query pattern analysis: basis of the table designDistribution keys: parallel processingComposite sorting keys: data ordered according to how they are queriedColumn compression: less disk reading For a payment processing company, the customer portal is a showcase of its service: a business that waits more than 20 seconds for a response loses trust. Optimizing the table design, rather than adding infrastructure, allows for real-time responses using the same database, and leaves the platform ready to continue growing in volume. Optimization also has a cost benefit: by reading less data in each query, the database uses fewer resources to respond, allowing more simultaneous users to be served without expanding the infrastructure. The work also documents the table design criteria, so the client's team can apply them to new queries and maintain performance as volume grows.

Results from our management

  • Queries on 322 million records: from 21 seconds to 357 ms.

  • Specific queries per period: 82 ms, compared to 26 minutes before.

  • With views materialized on query templates, times dropped to 35 ms.