I am building my own sharding solution with ASP.NET C# and MySQL. For the Id of each row I use the following:
- Shard Id – Int (1-65535)
- Table Type Id – Small Int (1-65535)
- Incremental number (1 – 4294967295)
So for example, an ID should be in the url like this:
http://mywebsite.com/folders/65535655354294967297
What I want to know is how to combine the numbers into a big number so I can extract the data later on. So for example, I won’t use 1 as the shard ID, I would probably need to you 00001 because later it will be easier to extract that number by making a division on the whole number.
So how can I do that, what is the best way to build a long number with three seperate numerical values and then be able to extract them back in code?
I look for the most efficient way to do it in C#
Thanks.
You can use hex represantations of numbers
OR