w3resource

Redis Server: SLOWLOG

Redis SLOWLOG Command

Redis SLOWLOG command is used in order to read and reset the Redis slow queries log.

What is Redis SLOW LOG?

The Redis Slow Log is a system to log queries that exceeded a specified execution time. The execution time does not include I/O operations like talking with the client, sending the reply and so forth, but just the time needed to actually execute the command.

Here are some common uses and scenarios for the "SLOWLOG" command:

  • Performance Analysis: Records and displays commands that exceed a specified execution time, helping to identify slow queries and performance bottlenecks.
  • Debugging: Assists in debugging by providing insights into which commands are taking longer than expected.
  • Optimization: Helps in optimizing server performance by pinpointing commands that may need to be optimized or restructured.
  • Monitoring: Useful for monitoring the server’s responsiveness and identifying patterns or issues affecting overall performance.

Syntax:

SLOWLOG subcommand [argument]

Available since

2.2.12.

Return Value

Simple string reply

Return Value Type

String

Example: Redis SLOWLOG

redis 127.0.0.1:6379> slowlog get 2
1) 1) (integer) 14
   2) (integer) 1309448221
   3) (integer) 15
   4) 1) "ping"
2) 1) (integer) 13
   2) (integer) 1309448128
   3) (integer) 30
   4) 1) "slowlog"
      2) "get"
      3) "100"  

Previous: SLAVEOF
Next: SYNC



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/redis/redis-server-slowlog-subcommand.php