dolfinus opened a new issue, #49907:
URL: https://github.com/apache/doris/issues/49907

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Description
   
   Currently queryId is generated using UUIDv4. Although it provides great 
uniqueness, it can be beneficial to use 
[UUIDv7](https://datatracker.ietf.org/doc/rfc9562/) instead:
   * UUIDv7 and UUIDv4 have the same number of bits, so no changes in field 
size.
   * UUIDv7 is generated using timestamp (milliseconds) + counter (optional) + 
random part, so values can be sorted, unlike UUIDv4. This is important for 
storing audit logs, as queries started one after another will be stored as 
table records next to each other.
   * The latter also greatly improves size of B-Tree indexes. For example, 
UUIDv4 indexes can take x10 size of UUIDv7 index because v4 values are not 
correlated with row position, and index bloat is a thing.
   * It is possible to extract timestamp (approximate) the query was created, 
without need to access `information_schema.active_queries` view. Also the view 
doesn't return queries which already finished, but because timestamp is already 
a part of UUIDv7, it can be extracted at any time.
   
   ### Solution
   
   Replace all occurances of `UUID.randomUUID()` with custom UUID generator. It 
doesn't require adding any dependencies, as UUID generation code is quire 
simple, and can be vendored.
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to