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

database optimizations #285

Open
columbian-chris opened this issue Feb 7, 2022 · 1 comment
Open

database optimizations #285

columbian-chris opened this issue Feb 7, 2022 · 1 comment

Comments

@columbian-chris
Copy link

columbian-chris commented Feb 7, 2022

This plugin is saving and storing a huge amount of unnecessary empty meta fields with every post save. Our site already has a huge database and I’m looking through the post meta table and seeing a ton of OneSignal fields with no data in them so they’re just taking up space.

I also found this support ticket in the Wordpress plugin directory so it looks like I’m not the only one to take notice of this issue.

To solve this issue, the plugin needs to operate under the implication that if there is no value set for a certain field than the value for it is false (that is speaking generally but hopefully you understand what I'm talking about). It also should delete a previously set value once a post is saved and that value is set to a false/off value (from updating a post and unchecking a previously checked box in the meta box).

I currently have 67,576 rows in my wp_postmeta database table and I've only had the plugin installed for a few months. Here's a breakdown of what I found in the table:

meta key total number of rows rows with blank value
onesignal_meta_box_present 21131 18
onesignal_send_notification 21131 21131
onesignal_modify_title_and_content 8438 8438
onesignal_notification_custom_content 8438 7
onesignal_notification_custom_heading 8438 7

There really is a large amount of room for improvement here. Let's only store fields if there's a value, or at the very least store a single row per post and store it as json (e.g. store a single meta field named something like "onesignal_options" and store the options as { meta_box_present: "value", send_notification: "value", modify_title_and_content: "value", notification_custom_content: "value", notification_custom_heading: "value" }). That would significantly reduce the number of rows in the table.

@rgomezp
Copy link
Contributor

rgomezp commented Mar 10, 2022

Howdy Chris,
Thank you for your suggestion. There is certainly room for improvement in this area. We do not have a timeline currently on getting this work done but your suggestion is good and we will certainly take this into consideration.

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

No branches or pull requests

2 participants