Multiple tables versus comma separated entries or searlization? (2 posts)

  1. chrismichaels84
    Posted 3 years ago #

    So, I am developing a project management plugin that allows for multiple projects, users, apps, etc. I've worked out my database schema to do what I need correctly I should really create 7 or more tables in the WordPress database and just use join statements to query the data I need.

    Or, I could do the same thing with about 3 tables if I store a lot of information in comma separated strings that I explode and implode or serialized arrays. Generally, I've been told to normalize my databases without regard to how many actual tables I need.

    What is the best practice here for WordPress? Is creating that many tables with a plugin a problem?

    Thanks for the input.

  2. Rebecca O'Brien
    Posted 3 years ago #

    I don't think there is a real "best practice." The rule I typically follow is clumping (generally, serializing) together data I will be retrieving at the same time.

    Example: How often do you retrieve first name without last name? Or website address without website name?

    So if the data will <i>in general</i> be retrieved at the same time, then I'd go with serializing. If it won't be, then make separate tables.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.