Skip to content

Instantly share code, notes, and snippets.

@morgo
Created June 24, 2014 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morgo/4f23b48fd3df09fb47f6 to your computer and use it in GitHub Desktop.
Save morgo/4f23b48fd3df09fb47f6 to your computer and use it in GitHub Desktop.
Wordpress wp_options VARCHAR increase.
mysql> CREATE TABLE `wp_options` (
-> `option_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
-> `option_name` varchar(64) NOT NULL DEFAULT '',
-> `option_value` longtext NOT NULL,
-> `autoload` varchar(20) NOT NULL DEFAULT 'yes',
-> PRIMARY KEY (`option_id`),
-> UNIQUE KEY `option_name` (`option_name`)
-> ) ENGINE=InnoDB AUTO_INCREMENT=43361 DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.02 sec)
mysql> INSERT INTO wp_options SELECT NULL, uuid(), REPEAT('a', 200), 'yes' FROM dual;
Query OK, 1 row affected (0.00 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> INSERT INTO wp_options SELECT NULL, uuid(), REPEAT('a', 200), 'yes' FROM wp_options a, wp_options b, wp_options c, wp_options d;
Query OK, 1 row affected (0.00 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> INSERT INTO wp_options SELECT NULL, uuid(), REPEAT('a', 200), 'yes' FROM wp_options a, wp_options b, wp_options c, wp_options d;
Query OK, 16 rows affected (0.01 sec)
Records: 16 Duplicates: 0 Warnings: 0
mysql> INSERT INTO wp_options SELECT NULL, uuid(), REPEAT('a', 200), 'yes' FROM wp_options a, wp_options b, wp_options c, wp_options d;
Query OK, 104976 rows affected (2.07 sec)
Records: 104976 Duplicates: 0 Warnings: 0
mysql> select count(*) from wp_options;
+----------+
| count(*) |
+----------+
| 104994 |
+----------+
1 row in set (0.04 sec)
mysql> ALTER TABLE wp_options CHANGE option_name option_name VARCHAR(255) NOT NULL;
Query OK, 104994 rows affected (1.71 sec)
Records: 104994 Duplicates: 0 Warnings: 0
mysql> ALTER TABLE wp_options ENGINE=MyISAM;
ALQuery OK, 104994 rows affected (3.14 sec)
Records: 104994 Duplicates: 0 Warnings: 0
mysql> ALTER TABLE wp_options CHANGE option_name option_name VARCHAR(64) NOT NULL;
Query OK, 104994 rows affected (1.58 sec)
Records: 104994 Duplicates: 0 Warnings: 0
mysql> ALTER TABLE wp_options CHANGE option_name option_name VARCHAR(255) NOT NULL;
Query OK, 104994 rows affected (2.84 sec)
Records: 104994 Duplicates: 0 Warnings: 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment