pg_sqlog
Provide SQL interface to logs
pg_sqlog : Provide SQL interface to logs
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 6500 | pg_sqlog | pg_sqlog | 1.6 |
STAT | BSD-3-Clause | SQL |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-- | No | Yes | No | Yes | no | no |
| Relationships | |
|---|---|
| Schemas | sqlog |
| Requires | file_fdw |
| See Also | log_fdw pg_stat_log logerrors pgelog file_fdw pg_csv aws_s3 pgdisablelogerror pgaudit pg_auth_mon |
require certain params
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.6 |
18 17 16 15 14 | pg_sqlog |
file_fdw |
| RPM | PIGSTY | 1.6 |
18 17 16 15 14 | pg_sqlog_$v |
- |
| DEB | PIGSTY | 1.6 |
18 17 16 15 14 | postgresql-$v-pg-sqlog |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 |
| el8.aarch64 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 |
| el9.x86_64 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 |
| el9.aarch64 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 |
| el10.x86_64 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 |
| el10.aarch64 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 |
| d12.x86_64 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 |
| d12.aarch64 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 |
| d13.x86_64 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 |
| d13.aarch64 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 |
| u22.x86_64 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 |
| u22.aarch64 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 |
| u24.x86_64 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 |
| u24.aarch64 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 |
| u26.x86_64 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 |
| u26.aarch64 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 | PIGSTY 1.6 |
Source
github.com/kouber/pg_sqlog
pg_sqlog-1.6.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Create this extension with:
Usage
pg_sqlog provides a SQL interface for querying PostgreSQL CSV log files using a foreign table backed by file_fdw.
Querying Logs
Slow Query Analysis
Functions
| Function | Description |
|---|---|
sqlog.log([timestamp]) |
Returns log contents for a given day |
sqlog.set_date([timestamp]) |
Set the date for sqlog.log table queries |
sqlog.duration(text) |
Extract query duration from message (ms) |
sqlog.preparable_query(text) |
Replace arguments with ? for grouping |
sqlog.summary(text, int, int) |
Strip metadata, show first/last N chars |
sqlog.temporary_file_size(text) |
Extract temp file size from message |
sqlog.autovacuum([timestamp]) |
Autovacuum report for a given day |
sqlog.autoanalyze([timestamp]) |
Autoanalyze report for a given day |
Autovacuum Reports
Prerequisites
Required postgresql.conf settings: