How to Configure ScyllaDB Slow Query Log

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up the scylladb slow query log by turning on slow query tracing. You also set a time threshold on each database node. Teams often turn this log on during an outage to find heavy reads. Broad database roles let users run large scans and change log settings at will. This extra load can hurt cluster speed for every app. How the scylladb slow query log works ScyllaDB tracks slow requests through its built-in tracing system. When you turn on this feature, the node watches the clock for eve

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up the scylladb slow query log by turning on slow query tracing. You also set a time threshold on each database node. Teams often turn this log on during an outage to find heavy reads. Broad database roles let users run large scans and change log settings at will. This extra load can hurt cluster speed for every app.

How the scylladb slow query log works

ScyllaDB tracks slow requests through its built-in tracing system. When you turn on this feature, the node watches the clock for every query. If a query takes longer than your set time limit, the node records it. The database writes these trace events into internal system tables. You can also set a fast mode that skips full step-by-step trace details. That mode only records the slow query text and basic timing facts. Admins can apply these settings through the node API or the main setup file. A node API update takes effect right away without a restart. A file update stays in place when the node restarts. Every node in the cluster manages its own local threshold and logging state. You must apply the same rule across all nodes for full cluster coverage.

How to read slow query records

Once the log is active, ScyllaDB stores slow query rows in a system keyspace. Admins log in and query this table to see which statements ran too long. Each record shows the start time, the client address, and the total run time. It also lists the parameters and the exact tables involved in the request. Teams check these rows to find full table scans or large partition reads. They also look for bad query patterns from a specific app or user. To keep disk use low, ScyllaDB attaches a time-to-live value to these trace rows. Old log rows expire and vanish on their own after the set period ends. You should query these system tables with care during peak traffic hours. Reading huge trace tables without filters can add even more load to busy nodes.

What native slow logging solves and what it misses

Native slow query logging helps teams fix bad app code after a slowdown occurs. It shows which statements missed a partition key or read too many rows. Yet this native setup only records bad queries after they already hit the cluster. It decides who can log in and run queries based on static database roles. It cannot inspect or block a dangerous statement before the node runs it. Worse, the trace tables often store raw query values in plain text. If a slow query includes emails, phone numbers, card numbers, or national IDs, those values sit inside the system tables. Any admin or developer who reads the trace table sees that raw data. Teams also share broad admin accounts just to toggle tracing or read system tables. Native role checks cannot require live peer review before someone runs an unindexed scan.

End-to-End Encryption + Log Aggregation & Correlation: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits inline in the protocol beside the service as an open-source proxy, a sidecar for your database or API. On every production query an agent or human runs, hoop.dev decides whether to pass, mask, block, or escalate it for review.

Before a query runs, hoop.dev guardrails check the statement against your rules, an AI Analyzer you configure can score intent or hold risky calls for human approval, and hoop.dev data masking rewrites sensitive fields in responses in memory. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Does the slow query log hurt ScyllaDB cluster speed?

Yes, if the time threshold is too low, the node writes too many traces. Raising the threshold or using lightweight logging mode keeps the extra load very small.

Where does ScyllaDB store slow query log records?

ScyllaDB writes slow query details into trace tables inside its internal system keyspace. These rows expire on their own after their built-in time limit passes.

Can I turn on slow query logging without restarting ScyllaDB?

Yes, you can turn it on and change the threshold through the node API. To keep the setting after a reboot, also save it in the setup file.

The query runs. The emails stay hidden.