How much is too much seralized data in a user meta field?

I’m using a plugin called WP Favorite Posts (http://wordpress.org/plugins/wp-favorite-posts/) in tandem with Membership, to add members only CPT IDs to user meta. The plugin stores this information as seralized data. I think I already know the answer to this question, but just want to verify before I venture down the path of rewriting how the data is stored.

Right now, the CPTs posts are being imported at a rate of 250/week as ‘publish’ status. Upon the next weekly import, the old posts are set to private.

There are some custom fields associated with the CPT, numbers, that sum ‘publish’, and then sum ‘all’ based on the meta key with the serialized value.

At this rate, a user could have 12,000 serialized CPT IDs over the course of a year.

I believe this is WAY too much and I’m thinking of writing a plugin where the client can simply click a “clear” button in the admin. This button will set the meta value for the favorites to null, after it calculates the total and updates another user meta field (where I will store the sum values).

Does it sound like I’m on the right track with this? I want this to not get incredibly SLOW over time. Does this make sense?

Any insight would be GREATLY appreciated.

Thanks!

  • Alexander
    • DEV MAN’s Mascot

    Hi @applemarketing,

    Yes, you’re definitely on the right track. It would definitely be good to keep this cleaned up, or at least separate the active data from archive data.

    As I’m sure you know, everytime you read or write to this data, it needs to repackage the whole thing again. It also needs to allocate that much RAM just to pull it off the shelf. Serialized data is great for managing settings, but not great when you need it to scale.

    If it’s not dependent on the client approving anything, you could setup a WP Cron task for this. Take a look at this here: http://codex.wordpress.org/Function_Reference/wp_schedule_event

    Best regards,

  • applemarketing
    • Site Builder, Child of Zeus

    Alexander,

    Thank you for the feedback. I will begin writing this information to another location and have the plugin be manual in the admin. The client will be updating on a semi-regular basis, but not exactly the same all of the time (it could be at at any time – one day of the week. So I will most likely stay away from CRON. An excellent suggestion though!

    Thank you so much for the feedback!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.