Saturday, February 15, 2025

Mencari Query Lambat di Postgres

/etc/postgresql/17/main/postgresql.conf

 #------------------------------------------------------------------------------
# CUSTOMIZED OPTIONS
#------------------------------------------------------------------------------

# Add settings for extensions here
shared_preload_libraries = 'auto_explain'

#Log query yang lebih lambat dari 3 detik
auto_explain.log_min_duration = '1s'

#Sertakan statistik waktu eksekusi
auto_explain.log_analyze = 'true'

#Sertakan informasi penggunaan buffer
auto_explain.log_buffers = 'true'

#Sertakan waktu setiap node dalam query plan
auto_explain.log_timing = 'true'

#Sertakan detail tambahan tentang query plan
auto_explain.log_verbose = 'true'

#Log subquery atau nested statement
auto_explain.log_nested_statements = 'true'


logging_collector = on
log_directory = 'pg_log'

#tempat log, cek di data_directory di file ini juga, default di: /var/lib/postgresql/17/main

 

#reff auto explain = https://www.postgresql.org/docs/current/auto-explain.html

 

No comments:

Post a Comment