Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8077133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:24:46+00:00 2026-06-05T15:24:46+00:00

Alongside the users table, WordPress has a usersmeta table with the following columns meta_id

  • 0

Alongside the users table, WordPress has a usersmeta table with the following columns

  • meta_id
  • user_id
  • meta_key (e.g. first_name)
  • meta_value (e.g. Tom)

Each user has 20 rows in the usersmeta table, regardless of whether or not the rows have a filled-in meta_value. That said, would it not be more efficient to add the always-present meta rows to the users table?

I’m guessing that the information in the users table is more frequently queried (e.g. user_id, username, pass), so it is more efficient to keep those rows smaller. Is this true? And are there other reasons for this separation of tables?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:24:47+00:00Added an answer on June 5, 2026 at 3:24 pm

    Entity Attribute Value

    It’s known as the Entity Attribute Value (EAV) data model, and allows an arbitrary number of attributes to be assigned to a given entity. That means any number of meta-data entries per user.

    Why use it

    By default there are a few keys that wordpress sets (20 stated in the question) but there can be any number. If all users have one thousand meta data entries – there are simply one thousand entries in the usermeta table for each user – it doesn’t have (in terms of the database structure) a limit to the number of meta data entries a user can have. It also permits one user to have one thousand meta data entires, whilst all others have 20 and still store the data efficiently – or any permutation thereof.

    In addition to flexibility, using this kind of structure permits the main users table to remain small – which means more efficient queries.

    Alternatives

    The alternatives to using EAV include:

    • Modify the schema whenever the number of attributes changes
    • Store all attributes in a serialized string (on the user object)
    • Use a schemaless db

    Permissions is the biggest problem with the first point, it is not a good idea to grant blanket access to alter the schema of your database tables, and is a (sane) roadblock for many if not most wordpress installs (hosted on wordpress.com or on a shared host where the db user has no alter permissions). Mysql also has a hard-limit of 4096 columns and 65,535 bytes per row. Attempting to store a large number of columns in a single table will eventually fail, along the way creating a table that is inefficient to query.

    Storing all attribute in a serialized string would make it difficult and slow to query by a meta-data value.

    WordPress is quite tied to mysql, and therefore changing datastore isn’t a realistic option.

    Further WP info

    If you aren’t using any/many plugins it’s possible you will have a constant number of rows in the usermeta table for each user, but typically each plugin you add may need to add meta-data for users; the number added may not be trivial and this data is stored in the usermeta table.

    The docs for add_meta_user may add some clarity as to why the database is structured that way. If you put code like this somewhere:

    add_user_meta($user_id, "favorite_color", "blue");
    

    It will create a row in the usermeta table for the given user_id, without the need to add a column (favorite_color) to the main users table. That makes it easy-ish to find users by favorite color without the need to modify the schema of the users table.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a table of users set up like this: CREATE TABLE
I'm using phpbb 3.0.8 at the moment. It has 3,000 users and around 60,000
-- Running within ASP.NET MVC alongside jQuery -- I'm using jQuery to render a
I want to update a column by adding a new value alongside the old
I have a hird-party dll that need to be installed alongside with my app.
I'm using CodeIgniter, alongside the highlight_code($string); ( More info ) function to provide syntax
I recently installed the Visual Studio 11 Beta alongside Visual Studio 2010. After that
I am attempting to develop a Play 2.0 web application alongside a core Java
I'm having some trouble floating images properly alongside text in a contenteditable div. Here's
Using stomp.py (3.0.5) with python (2.6) alongside Apache ActiveMQ (5.5.1). I have got the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.