当前位置:网站首页>PG operation and maintenance -- error log and slow log
PG operation and maintenance -- error log and slow log
2022-07-18 16:10:00 【51CTO】
Error log
Related parameters
Only time-based file switching will overwrite , File switching during server restart will not overwrite .
log The level of logging
log Level by parameter log_min_messages control , Respectively debug5 debug4 ..debug1、INFO、NOTICE、WARNING、ERROR、LOG、FATAL、PANIC The lower the level , The less logs you print .
Slow query log
log_min_duration_statement
By the parameter log_min_duration_statement control , If a sql The running time of the statement is greater than or equal to the set number of milliseconds , Then the SQL The statement and its running time will be recorded in the log , When set to 0 when , All the running SQL Statements will be recorded .
SQL Statement log
log_min_error_statement
Record a sql Generated a certain level of logs , Usually error log . By the parameter log_min_error_statement To control , Respectively debug5 debug4 ..debug1、INFO、NOTICE、WARNING、ERROR、LOG、FATAL、PANIC Level control .
log_statement
PG You can also control whether to record DDL、DML Or all SQL sentence , This parameter is determined by log_statement Controlled ,
(1) When set to none when , Don't record sql sentence ;
(2) When set to ddl when , Record all DDL sentence ;
(3) When set to mod when , Record DML,truncate,copy from etc. ,PREPARE、EXECUTE or EXPLAIN ANALYZE The statement produces an update , These statements will also be recorded
(4) When set to all when , all SQL Statements will be recorded .
notes : If used log_min_duration_statement, More than a certain time SQL The statement has been printed in the log , And these SQL Statement conforms to log_statement Parameter configuration and output to log , be SQL The statement will not be printed twice in the log , Only print once .
log_temp_files
When SQL With sorting 、 Temporary query results or Hash Temporary files will be generated , These temporary files are sometimes large , Need to be monitored , Parameters can be set “log_temp_files” Is an integer value , When the generated temporary file is greater than this value , Then print the information of the temporary file into the log file .
Execution plan log
PostgreSQL There are also the following debugging SQL Log parameters of execution plan and process .
·debug_print_parse: Set to “on” when , hold SQL The parse tree of is printed into the log .
·debug_print_rewritten: Set to “on” when , hold SQL Rewrite the query and print it to the log .
·debug_print_plan: Set to “on” when , hold SQL Print the execution plan of to the log .
·debug_pretty_print: Whether to indent above 3 Kind of log to make it more readable .
Other logs
PostgreSQL There are also many log switches , It is up to the user to decide what information to record in the log .
·log_checkpoints: Whether to record checkpoint.
·log_connections: Whether to record the connection of the client .
·log_disconnections: Whether to record the information of client disconnection .
·log_duration: Whether to record the duration of each completed statement , For clients using the extended query protocol , Syntax analysis 、 binding 、 perform , The time taken for each step is recorded separately .
·log_hostname: Whether to record the host name of the client .
·log_lock_waits: When a session waits longer than deadlock_timeout when , Whether to record a log message .
边栏推荐
- Excellent open source attack and defense weapon project of the whole network
- HCIP --- OSPF综合实验
- 图解数组计算模块NumPy下(三角函数、四舍五入函数(around)、取整、将弧度转化为角度、统计分析函数、中位数、数组的排序、argsort()、lexsort())
- Learn about Max again_ allowed_ packet
- 精度提升方法:自适应Tokens的高效视觉Transformer框架(已开源)
- 全局变量、局部变量、静态变量和常量的地址分配
- GPU accelerated opencv Library & reconfigure and generate opencv CUDA version using cmake and vs2019
- 关于唐医生的一切:真实的中国人工心脏是什么样?
- ELK集群部署(五)之部署FileBeat
- sqoop 从mysql 导入json格式中文乱码
猜你喜欢

pmp证书有用么?

CompressAI:基于pytorch的图像压缩框架使用

Add value to health and empower the times | xianle Health releases the annual Sustainable Development Report

Full decentralization of social networks

Comprehensively analyze the liquidity problems and solutions of NFT

如何利用无常损失从流动资金池中提取价值

OSPF的不规则区域

高等数学---第八章隐函数偏导数与全微分

Everything about Dr. Tang: what is the real Chinese artificial heart like?

中关村e谷·苏高新承办2022苏州中日韩高层次人才项目路演大赛
随机推荐
Elk service of elk cluster deployment (10)
[untitled] pseudo class selector and box model
如何利用无常损失从流动资金池中提取价值
C语言实训通讯录(静态和动态版本)
1388.3n pizza dynamic planning
图解数组计算模块NumPy下(三角函数、四舍五入函数(around)、取整、将弧度转化为角度、统计分析函数、中位数、数组的排序、argsort()、lexsort())
Add value to health and empower the times | xianle Health releases the annual Sustainable Development Report
7.14二分,LCA,差分,思维构造
数据库系统原理与应用教程(020)—— 登录 MySQL
C language training address book (static and dynamic versions)
剑指 Offer 09. 用两个栈实现队列
HCIP --- OSPF综合实验
TDSQL PG版再升级,深度参与开源生态建设
The merits and demerits of cefi in the perspective of liquidity
Refi heating up in summer: uniswap V3 and green asset pool are launched on CELO
1388. 3n 块披萨 动态规划
Halcon 距离计算
Sword finger offer 10- I. Fibonacci sequence (4 solutions)
牛客网——华为题库(81~90)
Uniapp code scanning native plug-ins (Google mlkit, zxing; support scanning multiple codes at the same time)