Bad Prompts, Bad Plans: Teaching AI to Understand PostgreSQL

Friday, June 26 at 13:00–13:50
  • postgresql lover working in a dev/sec/ops Teams on docker environments

Category: Developer Level: Intermediate Language: EN Room: 3.008

Large Language Models are increasingly used by developers to analyze SQL queries and PostgreSQL execution plans. In practice, many simply paste a query and an EXPLAIN ANALYZE output into an AI assistant and trust the answer.

However, without proper context, AI systems often produce incomplete or misleading recommendations. PostgreSQL performance analysis depends on many factors such as schema design, indexes, statistics, and configuration parameters that are rarely included in these prompts.

In this talk, we explore why AI struggles with PostgreSQL query plans and how better prompts and richer database context can significantly improve the quality of AI-assisted analysis. Using examples from the open-source tool pgAssistant, we show how combining deterministic database inspection with structured prompts can turn AI into a useful assistant rather than an unreliable Oracle.

Back

Join Us For Swiss PGDay 2026

25 & 26 June 2026

Rapperswil, Switzerland