• Trying to decide if I should use the built in postmeta table or create my own table for CPT data.

    I will be creating 2 CPTs, one is 59 fields, the other is 80-100.
    Stuffing that into postmeta (either 1 per post_id in a GIANT array or one meta per fields) seems pretty crazy considering I want to be able to filter based on those meta fields.

    I see it is possible to filter based on meta fields (and even looks like it is possible both ways: http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters ).

    Question is more about scaling. Goal is to have LOTS of posts so can easily seem the one row per meta causing the postmeta table to GROW out of control (1000 CPT posts would be 59,000 postmeta rows for one of the CPTs). I’m concerned the 1 meta per post_id with everything in an array option will be slow to filter.

    I am leaning towards using the built in meta (as opposed to custom db tables) because using the built in functions seems cleaner, robust, tested, proven.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter gmisura

    (@gmisura)

    Reference:

    http://codex.wordpress.org/Creating_Tables_with_Plugins
    “Before jumping in with a whole new table, however, consider if storing your plugin’s data in WordPress’ Post Meta (a.k.a. Custom Fields) would work. Post Meta is the preferred method; use it when possible/practical.”

    http://wordpress.stackexchange.com/questions/4852/post-meta-vs-seperate-database-tables

    Thread Starter gmisura

    (@gmisura)

    If I pick the postmeta option now, how hard would it be to change my mind later and switch to a custom db?

    Hi, gmisura.

    Like you, I’m considering this issue. An easy way out could be just inserting new columns of data into your CPT tables, as opposed to adding post-meta with the CPTs themselves.

    Thread Starter gmisura

    (@gmisura)

    Hi, gmisura.

    Like you, I’m considering this issue. An easy way out could be just inserting new columns of data into your CPT tables, as opposed to adding post-meta with the CPTs themselves.

    I don’t think inserting new columns would be a good solution. Modifying the WP DB seems like a problem waiting to happen.

    Having talked with the owner of androidandme.com, he is confident in the performance of WP_Query, at least while being run on WPEngine. So I’m ok with this option.

    So I’m ok with this option.

    By “this option” do you mean”WP_Query” (and as against “meta_query” or query_posts)?

    Also,if recall it right, modifying a

      table

    in wpdb is one option recommended by WordPress Codex(correct me if I’m wrong).

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘postmeta or custom db tables for CPT data’ is closed to new replies.