PlanetScale

Enhanced tagging in Postgres Query Insights

Mar 24, 2026Rafer Hazen
Enhanced tagging in Postgres Query Insights
SummaryAI, from the source post

This post introduces enhanced tagging capabilities to PlanetScale's Postgres Query Insights. It details how query tags, previously only metadata on individual logs, are now integrated into aggregated query data. This enables users to view tag distributions, search queries by tag, and see per-tag breakdowns of database-level statistics. The implementation leverages SQL comments (SQLCommenter) for tag injection and includes automatic tagging of `application_name`, `username`, and `remote_address`. The post also describes cardinality reduction strategies (per-tag limits and per-interval limits) to manage high-cardinality tags and optimize the data pipeline for efficient storage and processing of tag-enriched query data.

More from the Database Benchmarking Best Practices trail