[wp-trac] [WordPress Trac] #55942: Add a "type" field to the meta and options tables

WordPress Trac noreply at wordpress.org
Wed Apr 26 23:19:45 UTC 2023


#55942: Add a "type" field to the meta and options tables
-------------------------------------------------+-------------------------
 Reporter:  azaozz                               |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  6.3
Component:  Database                             |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests needs-      |     Focuses:
  testing                                        |  performance
-------------------------------------------------+-------------------------

Comment (by azaozz):

 Replying to [comment:40 OllieJones]:
 > 1. Avoid ENUMs. Altering tables to add values to them is unreasonably
 expensive.

 Yea, ENUMs are very expensive to update. It made sense to try using ENUM
 here as the list of values (PHP data types) is very unlikely to ever
 change.

 > 2. Don't forget about the availability of
 [igbinary_serialize()](https://www.php.net/manual/en/function.igbinary-
 serialize.php)

 Not sure if WP can use `igbinary_serialize()` as meta and option values
 are LONGTEXT. The PHP manual specifically mentions this.

   For example, igbinary_serialize() output should generally be stored in a
 BLOB field in a database, rather than a CHAR or TEXT field.

 Having said that, the scope of this ticket had to be reduced. The latest
 patch doesn't add new columns to the DB as there's no good way to ensure
 full backwards compatibility in `get_option()` and `get_metadata()`. I'll
 change the ticket's title and description accordingly.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55942#comment:43>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list