The RDB$DB_KEY
output in your select is just formatted for presentation on the client. It is not the actual key(!). The actual RDB$DB_KEY
is (for tables) an eight byte array (or a 64 bit number).
Now as to the ordering, I am not 100% sure about the exact implementation, but either the RDB$DB_KEY is big-endian, or this presentation is big-endian). In big-endian 0x0100
comes before 0x00fc
(in little endian it would be 0x0001
and 0xfc00
).
But as I already indicated in the comments, ordering by RDB$DB_KEY
almost never makes sense. The RDB$DB_KEY
represents a 'snapshot' of the physical location of a record that is only really valid for the duration of a transaction (simplified). The order of the RDB$DB_KEY
of multiple records usually does not reflect the insert order (and if it would, that order might be different after a back up and restore), but only the relative position on storage (for the currently visible record version).