-
Notifications
You must be signed in to change notification settings - Fork 1k
uuid support #586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Unfortunately not. This structure will not use last insert id, thus it wont work (as in.. the insert operation will not return the uuid, otherwise everything works fine). See: https://www.php.net/manual/en/mysqli.insert-id.php What you might do (as a workaround) is generating the uuid client side (isn't that the best practice anyway?). |
What about using sequences instead?
|
I was reading this: https://dev.mysql.com/doc/refman/5.5/en/information-functions.html#function_last-insert-id and found:
So maybe you can use this in the trigger:
I haven't tested it though.. |
I guess the same limitations apply. |
Thanks a lot @mevdschee, I'm really frustrated of this limitation because I want an effective way for using uuids or Sequences. I don't want to generate the values by client side or depending on using |
First of all, why don't you want to generate the values client side? I'm not asking because I want you to do this, only to learn from.
I did not propose to rely on the auto_increment value generated, but setting your own using
I noticed and I wonder, did you even try what I proposed? |
Let's work out a solution and document it in the README. Or did you give up already? |
This is the last resort.
I mentioned
Actually I tested the same logic before your suggestion because I digged in Google before posting this issue. There is no way to use
Then call
But I don't want to use this approach too (although it's much better than using |
I'm afraid that even happens with sequences.. unique is promised, gapless is not (in case of concurrency and failing queries)..
You don't, but it is what is returned by the library on an insert request.
Is this really an issue in your usecase? Even with 20% loss a bigint has many many numbers. |
Yes; because I want to use a single sequence for whole database which contains on many tables (about 150) with a 10 huge tables (the smallest one is at least 100 millions row) |
64bit = 9,223,372,036,854,775,807 even with 50% loss and 1,000,000 x 100 million rows you have 99.9% of your numbers unused.. |
You consider one table while I've many! still afraid of the collision. |
Any way, I spent a lot of time on this issue. |
You are welcome. Thank you for checking out PCA. Good luck with your project! |
Hi,
One of the limitations of PCA is
Primary keys should either be auto-increment (from 1 to 2^53) or UUID
Does this structure is supported by PCA?
The text was updated successfully, but these errors were encountered: