PostgreSQL - How to Configure Slow Query Log - Deepstash
PostgreSQL - How to Configure Slow Query Log

PostgreSQL - How to Configure Slow Query Log

Curated from: postgresql.org

Ideas, facts & insights covering these topics:

2 ideas

·

76 reads

Explore the World's Best Ideas

Join today and uncover 100+ curated journeys from 50+ topics. Unlock access to our mobile app with extensive features.

Enable slow query log

Enable slow query log

Set the followings settings in /etc/postgresql/15/main/postgresql.conf:

"Error Reporting and Logging"

  • logging_collector = on
  • log_min_duration_statement = 1s
  • log_lock_waits = on

"Run-time Statistics"

  • track_activity_query_size = 8192

3

40 reads

Analyze slow query log

Analyze slow query log

  1. Download the log files on your computer. The default location is /var/lib/postgresql/15/main/log/.
  2. Install pgBadger
  3. Analyze the logs: pgbadger -o stats.html --prefix '%m \[%p\] %q%u@%d' /dir\_with\_logs/\*.log
  4. Open the HTML output file in your browser to review the results

3

36 reads

IDEAS CURATED BY

ocpodariu

Alt account of @ocp. I use it to stash ideas about software engineering

Read & Learn

20x Faster

without
deepstash

with
deepstash

with

deepstash

Personalized microlearning

100+ Learning Journeys

Access to 200,000+ ideas

Access to the mobile app

Unlimited idea saving

Unlimited history

Unlimited listening to ideas

Downloading & offline access

Supercharge your mind with one idea per day

Enter your email and spend 1 minute every day to learn something new.

Email

I agree to receive email updates