WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#10546 closed feature request (wontfix)

Change VARCHAR keys to SMALLINT

Reported by: mikeschinkel Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.9
Component: Database Keywords: dev-feedback 2nd-opinion
Focuses: Cc:

Description

Back in 2.4 all ENUMs where changed to VARCHAR(20) for reasons of portability(FN1). That move addressed an abstract concern while introducing two (2) tangible concerns: 1.) bloating of indexes and 2.) reduction of scalability. This is especially a concern as the discussion for adding meta data for more types (i.e. links, comments, etc.) has the potential to add more meta records.

Personally I'd really like to see a move back to ENUMs (which are an excellent feature of MySQL) but failing that I'd recommend we add a wp_meta table with fields ID (smallint) and Name (varchar(255)) and use smallint foreign keys linking to wp_meta whereever varchar(20) keys are currently used. One or the other solution addresses these concerns, but status quo does not.

Footnotes:

FN1 - While the portability concern probably seemed like a good idea at the time it appears the concern may be little more than academic (FN2,FN3) especially considering how few plugins or themes would work with other databases.

FN2 - http://codex.wordpress.org/Using_Alternative_Databases

FN3 - http://wordpress.org/support/topic/549

Change History (4)

comment:1 dd325 years ago

  • Keywords dev-feedback 2nd-opinion added; enum keys portability mysql meta relational removed
  • Milestone changed from Unassigned to Future Release
  • Type changed from enhancement to feature request
  • Version set to 2.9

Strange we have (many useless) components for everything except Database..

comment:2 follow-up: westi5 years ago

  • Component changed from General to Database
  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

-1 to this and closing as WONTFIX.

Moving to SMALLINT does not have a huge benefit and just makes things less obvious.

It makes it much harder for plugins to create something for themselves as you now need a central registry for the type information and makes it all less obvious.

I don't see that there is a performance issue with the way we doing things now - if there is an actual performance issue (not a theoretical one) then there would be a case for investigating something different but the current solution has worked fine for posts and comment types for a long time.

comment:3 in reply to: ↑ 2 Denis-de-Bernardy5 years ago

Replying to westi:

Moving to SMALLINT does not have a huge benefit and just makes things less obvious.

Actually, it potentially makes things faster with large amounts of data, due to the much smaller index. But leaving this closed, as it goes against the general philosophy of WP.

comment:4 matt5 years ago

For what it's worth I've never seen this be a bottleneck in a real life scenario.

Note: See TracTickets for help on using tickets.