FULL AI ANALYSIS

PostgreSQL query becomes slow only with prepared statements

Generated Sep 17, 2026, 11:55:04 AM

Analysis summary

The reported behaviour is consistent with a generic prepared plan is poor for tenants whose row counts differ significantly. The safest next step is to verify that hypothesis with a reversible test before making permanent configuration changes.

Possible causes

A generic prepared plan is poor for tenants whose row counts differ significantly.

85%

A recent software, firmware or configuration change is exposing an existing compatibility issue.

39%

Suggested fixes

1

Verify the likely cause

Compare custom and generic plans with EXPLAIN ANALYZE, improve statistics and use an appropriate plan cache mode for the affected workload.

2

Validate and monitor

Reproduce the issue once after the change, review relevant logs or metrics, and keep a rollback path until the system has remained stable.