
The database's round trip, and the check that a database-bound run is on its host
Source:R/db_latency.R
knw_db_latency.RdA grade, a comparison and the visit walks are bound by the database, so CLAUDE.md runs them on the database's
own host. knw_db_latency() measures the connection: the median wall time of n SELECT 1 queries through
DBI::dbGetQuery(), with no warm-up, which is the path the host's 1.6 ms and a remote link's 104 to 110 ms were
measured on (2026-10-24, 2026-10-26). knw_db_latency_check() measures it and, over limit_ms, stops with the
round trip and what a remote link cost #92's comparison, unless remote is TRUE. 0310, 0320 and 0330
call it at connect, before any work, and set remote from REMOTE=TRUE; each logs the returned line.
Usage
knw_db_latency(conn, n = 20)
knw_db_latency_check(conn, remote = FALSE, limit_ms = 20, n = 20)Value
knw_db_latency(): the median round trip in ms. knw_db_latency_check(): a list of ms, limit_ms,
remote, over (the round trip is above the limit) and line, the measurement as one line for a log.