Database field size

I’m currently working on switching our database from … a whole series of different encodings/collations to utf8mb4 … however, I’ve run into one (so far) circumstance where the composite key that is on the table (announcement_settings.announcement_settings_pkey) would be too large for a key (1000 bytes) based on character length of 20,14,255 on a maximum size of 4 bytes per character (1156 bytes). Seems that the best course is to cut down the size of the announcement_settings.setting_name field from 255 chars to 235 (maximum length right now that i see in our table is 16 chars).

Can anyone think of any reason that the field shouldn’t be reduced in size? (PS: I’d love to contribute this back as a fix in OJS if the community is okay with the change).

Are there any other fields that are like this that can be snipped?

Best, +A

@asmecher would love your feedback here.

Hi @AndrewGearhart,

All the setting_name fields in the OJS database can be safely chopped down considerably, e.g. to 64 characters, which would still leave plenty of headroom. If you do send in a PR, please make sure to change things consistently – that would be the descriptors in OJS in dbscripts/xml/ojs_schema.xml, plus all the descriptors in the pkp-lib repository in xml/schema.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

for the url field in the referrals table, (referrals.url) … it is currently a varchar 255 … and a part of an composite key/index. Should this key really exist? capping the URL at 255 … I have nearly 4,000 of these that are 255 characters in length… I’d bet that they are truncated URLs.

Thoughts?

Hi @AndrewGearhart,

The referrals table is currently not used in OJS 3.x and will only exist for OJS 2.x to 3.x upgrades. We may reinstate the table in the future, but for now there’s no descriptor to adjust for it.

Regards,
Alec Smecher
Public Knowledge Project Team