I know it could be difficult to query a single item that saved in an array in wordpress postmeta table, but I have lots of metadata for a single post which may create too many rows for the postmeta table. So, I guess it might be better to save the meta in an array for each post, then, create an object to query the meta so that I can access the data by $obj->meta1. My question is:

  1. Will it be really bothering when the postmeta table has too many rows?

  2. Does saving data as array really solve my doubts?

  • 1
    Voted to close as "primarily opinion" but MySQL can handle a tremendous number of rows. If you need to search the data, save granular data one entry per row. Serialize only if you never need to query based on the serialized data.
    – s_ha_dum
    Commented Nov 27, 2013 at 5:51

1 Answer 1

  1. Unless you are building a heavy web application, with billions of rows ( and maybe even then ), the number of rows for MySQL is not an issue.

  2. Saving your data in an array will make calling the data simpler (just one call), and keep the database smaller, but it will make parsing and searching through the data more complicated. More often than not, simple and efficient searching greatly outweighs the benefits of a smaller database.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.