I have a bigint field in MariaDB/MySQL where the maximum allowable is 9223372036854775807. However, Alpha is changing it after 15 digits. I assume this is do to a 32 bit issue where beyond 15 digits it is treating it as floating point. At 16 digits random rounding issues begin and then 17< I seemingly have absolutely no control over.

Does Alpha support integers larger than 15 digits or is this a bug?

Why are we using the bigint? Time stamped keys to the millisecond with other numeric values added to it creating a full key but our method creates a key to have 18 digits, but I can only make it work up to 15 in Alpha. The maximum big init digits are 19. The bigint keys are better for indexing, sequential, and human readable than a GUID. The GUID option is not necessarily sequential and in MariaDB/MySQL it has to be a char field to use with Alpha which with millions of records can create performance issues.

The code below generates a key but the 16th digit is being rounded off. Is there a way to get it to calculate out to and store 18 digits or is that a limitation of the 32 bit edition of Alpha Software?

Here is some sample code...

FUNCTION sensor_key1 AS N ( )
dim now_stamp as c
dim gen_id as c
dim r_no as c
dim finish_key as N


' This function generates an big integer key with 18 digits;
' The sequential time stamp is the first 13 digits;
' The center digit is the id of this function;
' The ending 4 digits 14-18 are random numbers attempting uniqueness at the millisecond;


now_stamp = padr(remspecial(convert_type(time_to_unixtimestamp(now()),"C")),13,"0");
gen_id = "1";
r_no = substr(remspecial(convert_type(rand(),"C")),2,4);
finish_key = val(now_stamp + "" + gen_id + "" + r_no);
sensor_key1 = finish_key;
END FUNCTION

The only other solution I have found at this point is either change the epoch calculation from unix to some other smaller point and/or reduce the random number length added for uniqueness to get it at 15 digits. This key generator may be overkill but it is to allow for multiple keys at any given millisecond of generation so as not to be centrally managed. Similar to a GUID but without the global uniqueness probability yet also taking into consideration sequential aspects, storage size, and index performance.