• I’m working to develop a plugin that will be adding attaching quite a bit of information to each post. This could end up being anywhere from 15-25 items about each post.

    I’m debating whether it’s a better idea to add this data directly to the post meta table, or whether I should be creating a new table for the purposes of my plugin.

    If I were doing this for a small site, I wouldn’t waste much time on this debate. However, this is a plugin intended mainly for larger sites with upwards of 100,000 posts each.

    At the very least, I’m hoping someone could explain the theoretical complications with creating millions of rows. Would it really bother sql too much? Would the indexes in place realistically nullify the problem?

    Thanks,

    wjh.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Consider compacting those items into an array and storing the array as a single meta row if you can. Then at least you have one extra row per post instead of 20.

    Generally speaking, I don’t think it’s helpful to have a million rows in another table instead of an extra million in post meta. The main reason to consider a custom table is if you need to query for individual columns of data related to each post. You cannot do that if everything is compacted into an array.

    How you setup a DB is obviously very important for large, busy sites. The specifics of the best setup would depend on exactly how you need to access that data. While I have a sense of what’s more efficient, I don’t know what the upper limits of scale are where things are unacceptably bogged down. I don’t know if a particular efficient scheme will gain only microseconds or large fractions of a second. Only that it should be faster.

    I suppose one could build some sample tables and run tests using phpMyAdmin. The feedback of how long queries take would be very useful.

Viewing 1 replies (of 1 total)
  • The topic ‘Plugins storing postmeta: How much is too much?’ is closed to new replies.