3 ms·
I didn't provide enough context. There's nothing wrong with using UUID's, but I would avoid them for clustered indexes. And I would say typically you wouldn't
by braveo 9y ago
I didn't provide enough context.
There's nothing wrong with using UUID's, but I would avoid them for clustered indexes. And I would say typically you wouldn't care about whether or not UUID's were sequential unless you WERE putting them into a clustered index.
I'm sure there are use cases where you would worry about the sequential nature for reasons not related to clustered indexes, but in general what I said is true.
- UK-AL 9y agoYou application generates sequential guids before placing in a database with a clustered index. Thus solving the issue with NEWSEQUENTIALID and clustered index issue.
- lazulicurio 9y agoJust for other people reading this thread, as I've posted before[1], a word of caution if you're trying to generate sequential UUIDs client-side for SQL server: SQL server does not sort UUIDs in the order you'd expect. The bytes are ordered 10-11-12-13-14-15-8-9-7-6-5-4-3-2-1-0. [1] https://news.ycombinator.com/item?id=13120522 https://news.ycombinator.com/item?id=13120522
- braveo 9y agoI'm not sure what that buys you that you can't get by just using an identity column.
- UK-AL 9y agoPlaces where the user request, is detached from the actual insert. For example if you are using a queing system for user requests, but you still need to return an Id to the user. Fairly common when building a distributed application.
- braveo 9y agowhy do you need it to be sequential then?
- UK-AL 9y agoBecause it will eventually go into a clustered index once it's been processed.
- braveo 9y agoI'm not trying to be hardheaded, and I understand I don't see all of the nuance because I'm not familiar with the problem you were solving. But having said that, I have to go back to asking why you didn't just use an identity of some sort. I cannot see any reason outside of convenience why you would insist on sequential UUID's for that, and I would argue against the convenience seeing as how UUID's are not naturally sequential and any work you did to guarantee them being sequential would also have been useful for generating sequential integers in the software as well (even 128 bit integers). You could have literally created a 128-bit sequential integer, waved your hands, and then announced to the world that it's a UUID (you wouldn't even need to set the bit to determine which version of UUID unless you were using it outside of your environment for some reason). Unless there is some other requirement that I'm not aware of, I don't really understand what it buys you.
- UK-AL 9y agoCombed Guids are normally only partly sequential. It means they go be generated on any machine, returned to the user, and the request placed on a queue. Without completely messing up a clustered index.
- braveo 9y agoI don't think you can guarantee the generation of anything sequential across multiple machines without some sort of authority. A single machine, sure as long as the resolution you're using is small enough and/or you have a single point of authority on that machine. But across multiple machines? Can you explain to me how you're doing that across multiple machines without any sort of authority? If there's a way to do that I'm genuinely curious.