Measuring memory consumption and disk consumption

is there a way to measure the memory consumption and the disk consumption in cockroach db from an SQL client? not through the admin UI.

Thank you a lot in advance,


No, not yet. But we are considering extensions to SQL to inspect metrics data, so that would provide a solution. Not in the next release though.

Thanks for your interest in CockroachDB!

For storage you could try to use the crdb_internal.kv_store_status table.

@ mmohsen @ knz
there already is quite some info available in the crdb_internal schema in the system database:

select node_id, address
,round(cast(metrics ->> 'sys.cgo.allocbytes' as bigint)/1024/1024,4) as "cgo.allocMB"
,round(cast(metrics ->> 'sys.cgo.totalbytes' as bigint)/1024/1024,4) as "cgo.totalMB"
,round(cast(metrics ->> 'sys.go.allocbytes' as bigint)/1024/1024,4) as "go.allocMB"
,round(cast(metrics ->> 'sys.go.totalbytes' as bigint)/1024/1024,4) as "go.totalMB"
,round(cast(metrics ->> 'sql.mem.client.current' as float)/1024/1024.0, 4) as "sql.clientMB"
,round(cast(metrics ->> 'sys.rss' as bigint)/1024/1024, 4) as "rss"
from kv_node_status;

select node_id, store_id, capacity/1024/1024/1024 capacityGB
, available/1024/1024/1024 availableGB
, used/1024/1024/1024 usedGB
, logical_bytes/1024/1024/1024 logicalGB
from kv_store_status;

These show some memory usages, the used disk and the disc capacity. Only thing missing is the memory capacity. Or am I missing something?
(crdb 2.0 and 2.1-alpha)

1 Like

Thank you a million, that solves it