The application relates to the technical field of ID generation, in particular to a dynamic self-description unique ID generation method and
system. The method comprises the following steps: S1, obtaining an instance code, and calculating the effective binary bit number of the instance code as a length indication field; S2, obtaining a current
system timestamp, performing a
rollback state judgment based on the
timestamp and a historical time maintained by the
system, setting a
rollback state field according to a judgment result, and the
rollback state field at least comprising a rollback identification bit and a plurality of cycle state counter bits; the rollback identification bit is used for identifying whether in a time rollback window, and the cycle state counter bits are used for distinguishing different running periods and continuous rollback events; S3, comparing the relationship between the length indication field and a preset
mode switching threshold, and determining an ID dynamic part according to a comparison result, wherein the dynamic part comprises an instance code and a
natural sequence number; and S4, splicing the
timestamp, the length indication field, the rollback state field and the dynamic part to obtain a globally unique ID.