GRAPH.SLOWLOG

Returns a list containing up to 10 of the slowest queries issued against the given graph ID.

Only queries with a latency of 10 milliseconds or more are logged.

Each item in the list has the following structure:

  1. A Unix timestamp (double) at which the log entry was processed.
  2. The issued command.
  3. The issued query.
  4. The amount of time needed for its execution, in milliseconds (double).
  5. The query parameters (or (nil) if none were provided).

Examples

Get slowlog


from falkordb import FalkorDB
db = FalkorDB(host='localhost', port=6379)
graph = db.select_graph('graph_id')
slowlog = graph.slowlog()
print(slowlog)

import { FalkorDB } from 'falkordb';
const db = await FalkorDB.connect({
  socket: { host: 'localhost', port: 6379 }
});
const graph = db.selectGraph('graph_id');
const slowlog = await graph.slowLog();
console.log(slowlog);

GRAPH.SLOWLOG graph_id

Sample Output

GRAPH.SLOWLOG graph_id
 1) 1) "1581932396.723"
    2) "GRAPH.QUERY"
    3) "MATCH (a:Person)-[:FRIEND]->(e) RETURN e.name"
    4) "12.831"
    5) (nil)
 2) 1) "1581932396.891"
    2) "GRAPH.QUERY"
    3) "MATCH (me:Person)-[:FRIEND]->(:Person)-[:FRIEND]->(fof:Person) RETURN fof.name"
    4) "10.288"
    5) (nil)

Reset slowlog


graph.slowlog_reset()

GRAPH.SLOWLOG graph_id RESET

Once cleared the information is lost forever.

Frequently Asked Questions 4
What is the minimum latency for a query to appear in the slowlog?

Only queries with a latency of 10 milliseconds or more are logged in the slowlog.

How many entries does the slowlog store?

The slowlog stores up to 10 of the slowest queries issued against the given graph. Older entries are evicted when new slower queries are recorded.

Can I reset the slowlog?

Yes. Use GRAPH.SLOWLOG graph_name RESET to clear all entries. Note that once cleared, the information is lost permanently.

What information is included in each slowlog entry?

Each entry contains: (1) Unix timestamp, (2) the issued command, (3) the query string, (4) execution time in milliseconds, and (5) query parameters or nil if none were provided.