Skip to content

CloudWatch database insights not respecting parameter group SQL text limits

0

In CloudWatch database insights, the SQL text is being truncated shorter than both track_activity_query_size and pg_stat_statements.max The parameter group is applied and in sync, and the previous insights view before the migration to CloudWatch correctly displayed the full query text.

asked 15 days ago57 views

2 Answers
0

CloudWatch Database Insights has its own quota for maximum SQL text size that is separate from your database parameter group settings. Even if you have configured track_activity_query_size and pg_stat_statements.max to allow longer query text in your PostgreSQL parameter group, Database Insights enforces its own text size limit for display purposes.

To resolve this truncation issue, you would need to reduce your SQL text size to fit within the Database Insights quota. The dashboard's text size limitation is independent of the database engine's configuration, which is why you're seeing truncation even though your parameter group settings are properly applied and in sync.

This is a known limitation of the Database Insights dashboard itself, rather than an issue with your parameter group configuration or the data collection process. The query text that exceeds this quota simply cannot be fully displayed in the Database Insights interface, regardless of how the underlying database is configured to track and store query text.
Sources
Troubleshoot issues with Performance Insights and Cloudwatch Database Insights in Aurora | AWS re:Post

answered 15 days ago

AWS
SUPPORT ENGINEER

reviewed 15 days ago

0

The re:Post Agent answer is right on two points: the dashboard has its own SQL-text display limit that is independent of your parameter group, and that limit is documented behavior, not a misconfiguration on your side.

The gap is why the text is cut below track_activity_query_size, and how to recover the full statement. There are two separate limits:

  • Collection: track_activity_query_size (default 4096 bytes, static, so a change needs a reboot) governs how much text PostgreSQL stores and how much PI can capture or download.
  • Display: the Top SQL table shows 500 bytes per row, and the expanded SQL text section maxes at 4 KB. Anything past 4096 characters is shown truncated there regardless of how high track_activity_query_size is set, which is why raising the parameter alone doesn't fix the on-screen view.

To get the full statement (beyond the 4 KB view): use the Download button in the SQL text section, or the PI API. Both return the untruncated text, bounded only by track_activity_query_size, not the display cap:

aws pi get-dimension-key-details --service-type RDS \
  --identifier db-0abc123def456789 --group db.sql \
  --group-identifier <your-sql-id> --requested-dimensions statement

Two quick clarifications:

  • pg_stat_statements.max caps the number of tracked statements, not text length. Length is bounded by track_activity_query_size. Confirm the effective value (it is static, so reboot to apply): SHOW track_activity_query_size;
  • The old-vs-new difference tracks the migration from Performance Insights to CloudWatch Database Insights (PI reaches end of life June 30, 2026). The Download and API paths return the full text regardless of which UI you use, so use those if the console view falls short.

References:

AWS
SUPPORT ENGINEER

answered 15 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.