Dexter can ingest queries from several different sources depending on your database configuration:
1. Query Stats (pg_stat_statements)
Requires the pg_stat_statements extension enabled in your database:
CREATE EXTENSION pg_stat_statements;
Use with:
dexter <connection-options> --pg-stat-statements
2. Live Queries (pg_stat_activity)
Get queries currently running in the database:
dexter <connection-options> --pg-stat-activity
3. Log Files
Requires log_min_duration_statement to be set in your Postgres config (e.g., log_min_duration_statement = 10).
Process a log file:
dexter <connection-options> postgresql.log
Real-time streaming from logs:
tail -F -n +1 postgresql.log | dexter <connection-options> --stdin
Note: Use --input-format csv or --input-format json if required.
4. SQL Files and Single Queries
From a file:
dexter <connection-options> queries.sql
From a single string:
dexter <connection-options> -s "SELECT * FROM ..."