This topic describes the syntax of the HG_SHARD_ID_FOR_DISTRIBUTION_KEY
function in Hologres.
Introduction
HG_SHARD_ID_FOR_DISTRIBUTION_KEY
: queries the ID of the shard that consists of the specified key or composite key.
Synopsis
SELECT HG_SHARD_ID_FOR_DISTRIBUTION_KEY ( tablename [, column [...] ] )
Parameters
- tablename: the name of the table for which you want to query the shard.
- column: the key or composite key used to generate a shard.
Example
The following example queries the ID of the shard based on the composite key that contains the ORDERSKEY and CUSKEY fields:
CALL HG_SHARD_ID_FOR_DISTRIBUTION_KEY ( ORDERS, 'ORDERSKEY', 'CUSKEY' );