sql: expose KV range metadata to SQL for "experienced" admins #8990
Labels
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
E-easy
Easy issue to tackle, requires little or no CockroachDB experience
help wanted
Help is requested / needed by the one who filed the issue to fix it.
Milestone
This is a follow-up to #8938, a proposal to implement two new functions:
crdb_encode_pkey(table_or_index_name, expr...)
, returningbytea
, withtable_or_index_name
a string or identifier (string would be more easy and would create an opportunity to play with the virtual schema). This would compute and return the KV-level key encoding for the primary key of the specified table/index using the values given in the other arguments.crdb_current_range_bounds(pkey)
, wherepkey
is abytea
, returning a tuple of twobytea
, with the two values are the current known range bounds for the range containingpkey
.The two functions in combinations can then be used to estimate "distance" between two rows in a table, in the sense of whether they belong to the same range or not, and can be used as a follow-up to #8938 to check that a split requested with "ALTER TABLE ... SPLIT" was actually processed.
The function names are just proposals.
cc @mjibson
The text was updated successfully, but these errors were encountered: