Skip to content

sql: expose KV range metadata to SQL for "experienced" admins #8990

@knz

Description

@knz

This is a follow-up to #8938, a proposal to implement two new functions:

  • crdb_encode_pkey(table_or_index_name, expr...), returning bytea, with table_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), where pkey is a bytea, returning a tuple of two bytea, with the two values are the current known range bounds for the range containing pkey.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)E-easyEasy issue to tackle, requires little or no CockroachDB experiencehelp wantedHelp is requested / needed by the one who filed the issue to fix it.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions