Make WordPress Core

Opened 9 years ago

Closed 8 years ago

Last modified 6 years ago

#3725 closed defect (bug) (wontfix)

user_id in DB much larger than needed

Reported by: charleshooper Owned by: charleshooper
Milestone: Priority: low
Severity: minor Version: 2.2
Component: Optimization Keywords: has-patch 2nd-opinion dev-feedback
Focuses: Cc:


Since the maximum # of users WordPress can support has been accepted as much much smaller than 2,147,483,647 the database schema should be modified to change all columns that reference a user ID to type INT.

Currently, all of these columns are type BIGINT, except for link_owner in wp_links for some reason. In addition, user IDs are type-casted to INTs in some places in the WordPress core, such as in get_userdata.

The attached patch changes all of the columns referencing user IDs to INTs and bumps wp_db_version.

Attachments (1)

wp_small_userid.diff (1.9 KB) - added by charleshooper 9 years ago.
Reduces user ID size in DB and bumps wp_db_version

Download all attachments as: .zip

Change History (12)

@charleshooper9 years ago

Reduces user ID size in DB and bumps wp_db_version

comment:1 @charleshooper9 years ago

  • Status changed from new to assigned

comment:2 @charleshooper9 years ago

  • Owner changed from charleshooper to anonymous
  • Status changed from assigned to new

comment:3 @foolswisdom9 years ago

  • Milestone changed from 2.3 to 2.2

comment:4 @charleshooper9 years ago

  • Owner changed from anonymous to charleshooper
  • Status changed from new to assigned

comment:5 @matt9 years ago

The reason this (and several other fields) are set to be extra large in the DB because when you get to the point where you need to change it to be larger, it will be a very long (possibly days) operation with locked tables. There is no real cost to using the bigger fields, so in the hope that WP may someday be successful enough to need it I propose we leave the big fields in. (In the users table, and everywhere else.)

comment:6 @charleshooper9 years ago

  • Keywords 2nd-opinion added

Fair point. Perhaps the size of wp_links.link_owner should be increased then, for this same reason -- it's currently set to INT(11), unlike anywhere else.

comment:7 @charleshooper9 years ago

  • Keywords dev-feedback added

comment:8 @charleshooper9 years ago

The maximum size of INT() on MySQL is roughly one third of the world's population. +1 for my original patch

comment:9 @foolswisdom9 years ago

  • Milestone changed from 2.2 to 2.3

comment:10 @matt8 years ago

  • Resolution set to wontfix
  • Status changed from assigned to closed

comment:11 @foolswisdom8 years ago

  • Milestone 2.3 (trunk) deleted
Note: See TracTickets for help on using tickets.