Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Redis slow query log

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. What is Slow Log?

Slow log is the logging system Redis uses to record query execution time.

Query execution time refers to the time it takes to execute a query command alone, excluding IO operations such as client talking and sending replies.

In addition, slow log is stored in memory, reading and writing speed is very fast, so you can use it with confidence, do not have to worry about slowing down Redis because of slow log.

2. View Slow Query Log Parameters

127.0.0.1:6379> config get slowlog*

1) "slowlog-log-slower-than"

2)"10000" --units of subtle

3)"slowlog-max-len" --Maximum number of slow query logs saved

4) "128"

3. Dynamically modifiable, dynamic parameters

127.0.0.1:6379> config set slowlog-log-slower-than 100000

OK

127.0.0.1:6379> config set slowlog-max-len 256

OK

127.0.0.1:6379> config get slowlog*

1) "slowlog-log-slower-than"

2) "100000"

3) "slowlog-max-len"

4) "256"

4. view command

127.0.0.1:6379> slowlog get 2

1)1) (integer) 1 #log identifier for uniqueness

2)(integer) 1480331288 #The point in time at which the logged command was executed, expressed in UNIX timestamp format

3)(integer) 43136 #Query execution time in microseconds

4)1) "config" #commands executed, arranged in array form, complete command config get slowlog*

2) "get"

3) "slowlog*"

2) 1) (integer) 0

2) (integer) 1480331280

3) (integer) 54158

4) 1) "info"

127.0.0.1:6379>

127.0.0.1:6379> slowlog len

(integer) 2

5. clear command

127.0.0.1:6379> slowlog reset

OK

127.0.0.1:6379> slowlog get 2

(empty list or set)

127.0.0.1:6379>

6. help

127.0.0.1:6379> help slowlog

SLOWLOG subcommand [argument]

summary: Manages the Redis slow queries log

since: 2.2.12

group: server

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report