Um Framework Baseado em IA Generativa para Otimização de Queries em PostgreSQL: Um Estudo de Caso Industrial

  • Rafael F. Cardoso UFRGS
  • Leonardo C. Daronco Mconf Tecnologia

Resumo


A otimização manual de queries SQL lentas em bancos de dados como o PostgreSQL é um gargalo reativo e custoso para equipes de desenvolvimento. Este artigo propõe um framework que automatiza esse ciclo, utilizando um Modelo de Linguagem de Grande Escala (LLM) para analisar planos de execução e gerar otimizações acionáveis. Um estudo de caso industrial valida a abordagem, demonstrando sua eficácia na redução proativa da latência de queries e na otimização dos recursos de engenharia.

Referências

Datadog (2025). Datadog. [link].

Duboce Labs, Inc. (2025). pganalyze. [link].

He, J., Treude, C., and Lo, D. (2025). Llm-based multi-agent systems for software engineering: Literature review, vision, and the road ahead. ACM Trans. Softw. Eng. Methodol., 34(5).

Liu, F., Liu, Y., Shi, L., Huang, H., Wang, R., Yang, Z., Zhang, L., Li, Z., and Ma, Y. (2024). Exploring and evaluating hallucinations in llm-powered code generation.

Liu, X., Shen, S., Li, B., Ma, P., Jiang, R., Zhang, Y., Fan, J., Li, G., Tang, N., and Luo, Y. (2025). A survey of text-to-sql in the era of llms: Where are we, and where are we going? IEEE Transactions on Knowledge and Data Engineering, 37(10):5735–5754.

n8n (2025). n8n: Secure workflow automation for technical teams. [link].

The PostgreSQL Global Development Group (2025). Postgresql. [link].

Wang, J. and Chen, Y. (2023). A review on code generation with llms: Application and evaluation. In 2023 IEEE International Conference on Medical Artificial Intelligence (MedAI), pages 284–289.

Yan, C., Cheung, A., Yang, J., and Lu, S. (2017). Understanding database performance inefficiencies in real-world web applications. In Proceedings of the 2017 ACM on Conference on Information and Knowledge Management, CIKM ’17, page 1299–1308, New York, NY, USA. Association for Computing Machinery.
Publicado
12/11/2025
CARDOSO, Rafael F.; DARONCO, Leonardo C.. Um Framework Baseado em IA Generativa para Otimização de Queries em PostgreSQL: Um Estudo de Caso Industrial. In: ESCOLA REGIONAL DE APRENDIZADO DE MÁQUINA E INTELIGÊNCIA ARTIFICIAL DA REGIÃO SUL (ERAMIA-RS), 1. , 2025, Porto Alegre/RS. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2025 . p. 448-451. DOI: https://doi.org/10.5753/eramiars.2025.16771.