Quality assurance · Production

Agoda integrates GPT into CI/CD pipeline to optimize SQL stored procedures

The problem

SQL stored procedure optimization consumed approximately 366 man-days per year at Agoda, with 320 of those days on performance test failures alone, and 90th-percentile MR approval times reaching 4.1 hours.

Workflow diagram · grounded in source
1
SP merge request triggers CI/CD test
trigger
“Every new SP triggers a merge request (MR), which kicks off performance tests in our CI/CD pipeline”
2
Context preparation for GPT
integration
“We provide GPT with comprehensive inputs to ensure accurate analysis”
3
GPT generates optimization recommendations
ai_action
“For each SP, GPT processes the inputs and provides actionable insights. Its analysis focuses on three key areas:”
4
GPT outputs optimized SP and indexes
output
“GPT provides two key outputs for each SP: Optimized SP: A revised version of the stored procedure with improvements to enhance performance. Suggested Indexes: Recommendations for new or modified indexes to address inefficiencies.”
5
Performance comparison added to MR
output
“The summary result includes a performance comparison between the original SP and the GPT-optimized version. This side-by-side comparison helps dbdevs and developers make informed decisions by highlighting the differences in performance. …”
6
Developer reviews and applies
human_review
“Below is an example of a GitLab MR comment where developers can review GPT's suggestions and click to apply the optimized SP and suggested indexes”
Reported outcome

After integrating GPT, the team observed reduced manual review time and improved SP quality, with GPT optimization accuracy reaching around 25%.

Reported metrics
annual SP optimization effortapproximately 366 man-days
Annual effort on performance test failures320
90th percentile MR approval time4.1 hours
GPT optimization accuracyaround 25%
Show all 6 reported metrics
annual SP optimization effortapproximately 366 man-days
annual effort on performance test failures320
90th percentile MR approval time4.1 hours
GPT optimization accuracyaround 25%
database resource usagesignificantly reduced database resource usage
manual review timespend less time analyzing performance issues and debugging SPs
Reported stack
GPTGitLab
Source
https://medium.com/agoda-engineering/how-agoda-uses-gpt-to-optimize-sql-stored-procedures-in-ci-cd-29caf730c46c
Read source ↗

Frequently asked questions

What did this team achieve with this AI workflow?

After integrating GPT, the team observed reduced manual review time and improved SP quality, with GPT optimization accuracy reaching around 25%.

What tools did this team use?

GPT, GitLab.

What results were reported?

annual SP optimization effort: approximately 366 man-days; Annual effort on performance test failures: 320; 90th percentile MR approval time: 4.1 hours; GPT optimization accuracy: around 25% (source-reported, not independently verified).

How is this quality assurance AI workflow structured?

SP merge request triggers CI/CD test → Context preparation for GPT → GPT generates optimization recommendations → GPT outputs optimized SP and indexes → Performance comparison added to MR → Developer reviews and applies.