Skip to content

sys.row_number_from_rowid

Return the row number for a row (starting from 0). Row numbers are relative values that are unique to a given combination of worker, SSD, and shard.

sys.row_number_from_rowid(rowid)

See System Columns in Tables.

This function accepts either the string rowid as its input or a specific rowid value. In most cases you will use the string rowid to return the specific row ID for each row in a set of rows. (If you specify an individual row ID as the input to the function, make sure it is valid; the system does not detect row IDs that are not valid or do not exist.)

For example:

yellowbrick_test=# select sys.worker_id_from_rowid(rowid) worker, 
sys.filesys_number_from_rowid(rowid) ssd, 
sys.inode_number_from_rowid(rowid) shard, 
sys.row_number_from_rowid(rowid) rownum 
from matchstats order by 1 limit 10;
 worker | ssd | shard  | rownum 
--------+-----+--------+--------
     0 |   7 | 168961 | 338055
     0 |   7 | 168961 | 338056
     0 |   7 | 168961 | 338057
     0 |   7 | 168961 | 338058
     0 |   7 | 168961 | 338059
     0 |   7 | 168961 | 338060
     0 |   7 | 168961 | 338061
     0 |   7 | 168961 | 338062
     0 |   7 | 168961 | 338063
     0 |   7 | 168961 | 338064
(10 rows)

Parent topic:System Functions