• Hi,

    I’m looking for create a control of the emails in the page, storing the date, name, content, subject, etc (for do analytics and emails limits).

    What type of management recommends?

    1- Custom post type
    2- Custom Database Table
    3- Other

    This question is more about performance because if all the data is stored in the tables posts and postmeta. This can reduce the performance?

    Regards.
    Lucas

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator bcworkz

    (@bcworkz)

    It depends on how you plan to query for data after it has been entered. If queries will be by conventional post data like date, author, content, etc., using a custom post type will be fine. If you plan on making queries qualified by complex post meta criteria, you may be better off storing at least the meta data in a custom table which can be more efficiently indexed for the nature of your data. The post type data can still remain as-is. Join in the custom meta data table by post ID.

    Thread Starter onsterion

    (@onsterion)

    Hi @bcworkz,

    I think fits with the custom post type because i need a:

    – date (post_date)
    – subject (post_title)
    – message (post_content)
    – delivery_status (can be a post_meta)
    – from (can be a post_meta)
    – to (can be a post_meta)
    – module (can be a post_meta)

    Regards,
    Lucas

    Moderator bcworkz

    (@bcworkz)

    Agreed, it’s the post meta that could be less than ideal. Querying for posts that have a specific status, for example, works reasonably well. But if you regularly query for posts with a particular status which are sent to an array of recipients AND there are a very large number of posts to search through, post meta queries are going to be time consuming.

    If the same queries are repeatedly done, caching can overcome the drawbacks. Or if making such queries only once in a while where waiting for results isn’t a major impact, perhaps the post meta schema will be OK. But if the time needed for post meta queries would be a significant detriment, then a custom table for what would have been meta data is probably in order. If each field is a separate column in a table, it’ll be much more performant than the key/value schema of post meta.

    Thread Starter onsterion

    (@onsterion)

    Hi @bcworkz,

    My idea is to create an “Email Center” section in the Admin Panel where all emails sent from wordpress and from other plugins (own plugins) stay in one place for log purposes and check the count of emails being consumed in total and per month.

    Regards,
    Lucas

    Moderator bcworkz

    (@bcworkz)

    That’s a great idea! Our mail clients have a “sent” folder, why shouldn’t a WP site?

    A count query in total or by month wouldn’t even involve meta data. Storing related data in post meta should be fine. If someone wanted to query for something like all messages sent to a specific address, they can do so. It just might take a while if there are a very large number of records to search through.

    Thread Starter onsterion

    (@onsterion)

    Hi @bcworkz,

    Thanks for your time.

    Regards,
    Lucas

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Database recommendation’ is closed to new replies.