0
votes

I have a situation where I am trying to decide on whether to use the wordpress post meta table for storing information for a web application and would appreciate your suggestions.

Lets say my application has a post type that has about 30 post meta fields. Now lets say I have 10,000 users each having this post type. This will equate to 300,000 rows in the post meta table.

Now this application will never actually need to query a particular post meta to check if it contains a certain value. It will only require to obtain a dump of all post meta for a specific post id and update all the post meta for a particular post id all at once. In other words the only thing I am actually querying from the post meta table is the post id.

Would it be any beneficial in terms of data read/write speed for me to create a custom wordpress database table with the 30 columns instead if i am not actually going to query the post meta?

Using the post meta table makes it so much easier during the development phase as it easily integrates with wordpress, plus I can expand/contract the post meta fields without actually changing the structure of the table.

Any help would be appreciated.

1

1 Answers

0
votes

Now this application will never actually need to query a particular post meta to check if it contains a certain value.

You could store all the data for each post in a single meta entry per post by using an array of keys and values. WordPress will serialize/unserialize that for you when getting/setting the metadata.

e.g.

my_meta_key = array( '1' => one, '2' => two )

vs

my_meta_key_1 = one
my_meta_key_2 = two

That brings the record count down to 10k vs 300k.