Skip to content
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

uuid's should be stored in a BINARY(16) field using doctrine for optimal performance. #63

Closed
WouterSioen opened this issue Jun 16, 2015 · 8 comments

Comments

@WouterSioen
Copy link

It would be more performant to save the data in a BINARY(16) field then in a CHAR(36) field.

There are some benchmarks in here: http://iops.io/blog/storing-billions-uuid-fields-mysql-innodb/
And some info here: https://stackoverflow.com/questions/10950202/how-to-store-uuid-as-number

I think it should be rather easy to implement this in the convertToPHPValue and convertToDatabaseValue fields. If you're interested, I'll create a pull request for this.

@ramsey
Copy link
Owner

ramsey commented Jun 16, 2015

Let's hold off on that PR for right now. I have #51 open right now. I should be able to get to that tonight, which will involve completely separating the Doctrine UUID type into its own separate library.

@ramsey
Copy link
Owner

ramsey commented Jun 16, 2015

What I meant to say was: once I separate the Doctrine type into a separate lib, then you may send the PR against that lib. :-)

@WouterSioen
Copy link
Author

Great! You can give me a poke when this is done :)

@marijn
Copy link
Contributor

marijn commented Jun 16, 2015

In my opinion that should be a setting. We're very happy with our textual representation of UUIDs in the database. It makes support/debugging a lot easier.

@WouterSioen
Copy link
Author

Both types could be added in the library. something like uuid and uuid_binary.

@marijn
Copy link
Contributor

marijn commented Jun 16, 2015

Both types could be added in the library. something like uuid and uuid_binary.

👍

@zerrvox
Copy link
Contributor

zerrvox commented Jun 19, 2015

I very much agree with both possibilities. Doctrine MongoDB ODM stores them in a binary format, which makes it really hard to work with if you need to do queries outside your code, and it would be a major BC break, so +1 for choice uuid_binary type

@ramsey
Copy link
Owner

ramsey commented Jun 21, 2015

Thanks for your patience. I've created ramsey/uuid-doctrine and have moved the relevant code there. It's all set up and ready to go. Feel free to make your pull request there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants