Log Analytics with OpenTelemetry
Store and analyze high-volume application logs and OpenTelemetry traces in PostgreSQL with pg_mooncake and object-storage-backed Parquet columnstore mirrors.
PostgreSQL is rarely used for large-scale log analytics because uncompressed heap tables and indexes grow expensive quickly, and full-table scans over millions of log entries are slow.
With pg_mooncake, you can combine partitioned PostgreSQL log ingestion with an object-storage-backed columnstore mirror:
- Low storage cost: Historical logs are compressed into columnar Parquet files on S3, Cloudflare R2, or local disk.
- Simple self-hosting: Just PostgreSQL + object storage—no Elasticsearch or ClickHouse cluster required.
- Fast vectorized scans: DuckDB 2.0 scans millions of log records per second with segment elimination on timestamps.
Implementation Pattern
Combine a time-partitioned rowstore table for log ingestion with a USING mooncake columnstore mirror for analytical queries:
As daily log partitions age out (for example, after 24 or 48 hours), drop the old partitions from application_logs (DROP TABLE application_logs_2026_11_01;) as described in Archiving Large Postgres Tables. The complete log history remains queryable in application_logs_analytics.