Is there a way to extract UUID
value from crdb_internal.transaction_contention_events.contending_key
?
#89478
-
Related to #61625 I'm trying to debug contention using SELECT contending_key,
crdb_internal.pretty_key(contending_key, 0),
crdb_internal.pretty_key(contending_key, 2)
FROM crdb_internal.transaction_contention_events
SELECT b'\xeb\x87VS;\x93N\x97\x9c#\x1a57\xf2\xae\xb9'::UUID
Manually doing it seems really suboptimal. Is there a way to extract From what I an tell from signature of |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, @ilslv, I dug in a bit and we don't have a very satisfying answer for you, since we're generally designing around these keys being opaque values. And But if I put this ALL CAPS DON'T DO THIS IN PRODUCTION warning here, for debugging purposes, you might have better luck pulling the bytes you want directly out of the key. The general format of the keys you're looking at is a couple of variable-length-encoded identifiers, then an SELECT substring(x'F718A38912EB8756533B934E979C231A3537F2AEB9000188', 6, 16)::UUID; |
Beta Was this translation helpful? Give feedback.
Hi, @ilslv, I dug in a bit and we don't have a very satisfying answer for you, since we're generally designing around these keys being opaque values. And
crdb_internal.pretty_key
formats raw bytes with Go's "%q" specifier, which we don't have any SQL function support for parsing.But if I put this ALL CAPS DON'T DO THIS IN PRODUCTION warning here, for debugging purposes, you might have better luck pulling the bytes you want directly out of the key. The general format of the keys you're looking at is a couple of variable-length-encoded identifiers, then an
0x12
byte array marker, then the 16 bytes of the uuid, then maybe more stuff. The tricky part is not knowing how many bytes those leadi…