Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Advice Needed for Post Meta Database Efficiency

Short answer- It Depends

Long answer-

It’s generally faster to query to 1 row in a single table rather than 20 rows of meta information but there are somethings you should cosider

20 custom meta boxes doesn’t mean that there are 20 postmeta values. User might be filling only 5 of them & then that would mean that post meta table is faster

WordPress automatically queries the post’s meta when quering the posts, so that means you’re already issuing a database query, even when meta information is in other table. If the information in the custom table is not heavy, it would make more sense to add it to post meta even if it means 20 rows. You could though, ask wp not to query for meta information

Think about when the fields are actually used. Is it used everytime the post is queried? Is it used at multiple places on same page? If yes, it probably is better to let wordpress handle it & use automatic caching. On the other hand if the field is only displayed on single page, it makes more sense to do a separate query just on that page.

This also depends on other things that you don’t have much control over such as your server’s RAM

If the meta information are articles, then it’s best to issue a separate query to another table. If they are small sentences, url’s etc. then postmeta will work fine.

The efficient way might even have a mix of postmeta as well as custom table & we can’t say that one is better than other without actually knowing the data(which sometimes even the developer doesn’t know). I recommend trying out both methods & see what works best for you

Related Posts:

  1. Query all posts where a meta key does not exist
  2. Correctly delete posts with meta and attachments [duplicate]
  3. Storing revisions of metadata for custom post type
  4. Admin Area Custom Type Search By Meta Fields Without Title & Content
  5. How can I filter posts by post_parent in the admin?
  6. Custom Post Type with Input fields to seperate table on database.
  7. How to create a mini directory in WordPress?
  8. How Can I save multiple records in same meta key?
  9. Detect meta value changes when post is updated (post_updated)
  10. Search everything (posts, pages, tags, cpt, meta)
  11. Permalinks using event date (year & month) instead of publication date
  12. Compare 3 custom fields and sort by oldest
  13. Creating a custom post type upon registration
  14. Reason action hook won’t work with update_post_meta from frontend form? Alternative?
  15. Can’t sort order of wp_query with 2 meta keys
  16. Showing Meta Data for Custom Post Types?
  17. How to get source of custom meta image?
  18. Having trouble with custom post type / meta box
  19. Query for posts from any post type but only add instock products
  20. update custom post type meta from a shortcode
  21. Custom Meta Boxes – Nonce Issue – Move to trash issue
  22. Displaying Meta Box Image
  23. How to keep a check box in custom meta box for custom post type checked by default for add new post?
  24. Show metabox in custom-post-template depending on taxonomy term?
  25. ACF Upload Image in repeater from front-end with custom form? – add_post_meta()
  26. Using date stored as custom field to filter posts displayed in admin
  27. Meta Box Only in CPT Edit Page, Not in Add New
  28. get_post_meta is returning image id
  29. get_template_part() – post-meta not working?
  30. Metadata for a taxonomy – is there any WordPress way of doing this?
  31. Populate Custom Fields in a Custom Post Type?
  32. Insert Multiple Post with Same Publish Button
  33. Update CPT post meta with update_post_meta and cron job
  34. Custom meta box data array: foreach not working correctly?
  35. How to check if user meta field is empty in conditional else statement
  36. Get posts between custom dates
  37. A better way to add a meta box to custom post types
  38. Should wp_postmeta meta_key always be unique for a given post_id?
  39. How do I set all of a particular post meta to a value within the custom post type I’m in?
  40. Metabox not show in categories custom post type cmb2
  41. Storing a many to many post type relationship in post meta and keeping SQL ability for Joins
  42. Importing Data from a Non-WordPress database, into WP
  43. List Taxonomies: Don’t list taxonomy if it has no post – depending on custom post-meta?
  44. Can’t publish custom post type – “You are not allowed to edit this post.”
  45. Filter date from post meta when date is in string format
  46. Get only used meta_values
  47. Get $post->ID from a URL
  48. Displaying a div from an assigned meta_value when on a page
  49. Setting Post Title via Meta Data returns Auto-draft
  50. Values from meta-box not on $_POST
  51. Returning a custom content types with meta values
  52. Custom post type suddenly stoped working after WordPress 5 update
  53. How to show custom field on specific custom post type posts only when filled
  54. is_main_query() never called on WP 4.4
  55. How can I output WPAlchemy repeating fields meta values in my page template?
  56. Meta box data not saving
  57. Related posts meta_query CPT
  58. Meta box with front-end styling
  59. How can I get some of a posts meta data whilst it is still inserting?
  60. How to retrive Custom Post Type Meta Fields in Custom WP_Query
  61. Cannot Save MetaBox Data in Custom Post Type
  62. best way to use custom taxonomy, post type and meta in a job system
  63. Say I have a tech blog, how best would I store technical specs for a phone, if i use custom post types
  64. How to order custom posts by one of the custom fields value, ‘date’?
  65. Hide title field of selected post-types on edit pages
  66. WordPress CPT Taxonomy Dashboard Search – How to include taxonomy in search?
  67. Custom Post Type meta data getting deleted on bulk editing taxonomies
  68. How to create review point system for CPTs (many-to-many relationship)
  69. After inserting new post with wp_insert_post() the post is not visble to WP_Query, but the same WP_Query works for post inserted from wp-admin panel
  70. How can I write a function that would update any missing specific post metadata?
  71. SELECT custom post type and its meta in SQL
  72. How to keep custom post type related information
  73. Custom attachment function not working in v5.4.2?
  74. Can’t save meta box data in WordPress using custom post types
  75. Creating a custom post type upon registration for a specific user role
  76. How can I use a custom template to load custom post type posts based on a post_meta value
  77. How to properly get the wp_postmeta.meta_value of a custom post type in specifics?
  78. Custom Function to redirect singular post if specific meta field is empty
  79. Saving Child Terms on front end not setting parent
  80. Custom post type: “transition_post_status” action get title and other fields
  81. update a posts of other custom post type
  82. How do I extract the contents of a CPT’s custom field for all posts?
  83. Collect custom post in a calendar
  84. Delete custom post type metadata without deleting the post in admin area
  85. Order by post meta value gets random results
  86. How can I get the $key / $value pairs of custom fields that were added via 3rd party plugins or themes?
  87. meta query always fails even if data is correct
  88. Display a post count from a custom metabox selection
  89. Rich Custom Field for Custom Post type not saving
  90. Custom post type submenu sorted by specific meta_key & meta_value
  91. Advanced search form with filters for custom taxonomies and custom fields
  92. Querying meta values within an array
  93. Post AND page parameter for WP function
  94. why get_post_meta is returning 0?
  95. Save post_parent in a custom post type
  96. How to display Author Profile based on Custom field value
  97. Automatically add custom taxonomy when meta value gets to a set number or beyond
  98. Display a list of posts whose meta field values are equal to the ID of the post being viewed?
  99. Check for custom field value in different post type than current one and do something
  100. I am having a problem with fetching product data in the Gutenberg block editor
Categories custom-post-types Tags custom-post-types, post-meta
login_redirect for Mobile Web
Echo a div to header.php from functions.php

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress