-
Notifications
You must be signed in to change notification settings - Fork 824
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
NEW Create DBClassNameVarchar #11359
NEW Create DBClassNameVarchar #11359
Conversation
4da32c1
to
44c7ac1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@emteknetnz I saw you doing some performance tests of enum vs varchar, but I don't see the results of that anyway. Can you please dump those in a comment somewhere so I can validate your results?
I used the code in #11358 (comment) slightly modified to generate 1,000,000 rows and to set a fairly standard looking FQCN
I then used the config to switch between enum and varchar, and then ran the following SQL to get the database size - note you may need to drop the database before switching as the ClassName isn't a valid class
At first glance it's a huge relative % increase, though ignore that because there's almost no other data in the database so the ClassName column is a large proportion of it. In the real world this won't be the case Size difference is 180.8 - 118.6 = 62.2mb per 1,000,000, or 6.2 mb per 100,000. I realised the first time I did that I didn't have quad slashes in my script so the slashes weren't in the database so I had slightly less data stored. I'll bump up the estimate to 7mb per 100,000 in the docs to be conservative |
44c7ac1
to
91afb9e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After I've changed to varchar, if I add or remove a DataObject
subclass, I still see the following in dev/build
which are clearly alter table queries:
Field ChangeSetItem.ObjectClass: changed to enum( ........ ) character set utf8mb4 collate utf8mb4_unicode_ci default 'SilverStripe\\Assets\\File' (from enum( ....... )
Field FileLink.ParentClass: changed to enum( ........ ) character set utf8mb4 collate utf8mb4_unicode_ci default 'SilverStripe\\Assets\\File' (from enum( ....... )
Field SiteTreeLink.ParentClass: changed to enum( ........ ) character set utf8mb4 collate utf8mb4_unicode_ci default 'SilverStripe\\Assets\\File' (from enum( ....... )
The first one is particularly concerning, because change set items are created every time anything is published, which means there will be a lot of those records.
We should probably either account for that somehow in the code, or else add examples of how to update these as well in the docs.
91afb9e
to
a0ad753
Compare
Need some additional config to get DBPolymorphicForeignKey to use varchar, have updated code sample + docs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Issue #11358