Permalink
Browse files

change mysql table definitions to BLOB, MEDIUMBLOB

* the mentioned maximum row length of 64kb in MyISAM does not include
  BLOBish fields.

  http://dev.mysql.com/doc/refman/5.1/en/storage-requirements.html
    The maximum size of a row in a MyISAM table is 65,535 bytes. This
    figure excludes BLOB or TEXT columns, which contribute only 9 to 12
    bytes toward this size.

* change from TEXT to BLOB since we store binary data. we do not want
  MySQL to try to convert charsets if the connection charset differs
  from the table charset. This is most obvious for the compressed data
  but also applies to our ordinary serialization
* change to MEDIUMBLOB for perfdata since it lessens the chance of
  truncation bugs and only adds 1 byte per row to the fixed storage
  requirement
* remove mention of MySQL/MyISAM specific requirements from other DB
  classes
  • Loading branch information...
1 parent 1488106 commit 9af7df65515d318b107b749dc9c89b93764d7d39 @chrono chrono committed with preinheimer Feb 1, 2011
@@ -115,11 +115,11 @@ protected function db()
`c_url` varchar(255) default NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`server name` varchar(64) default NULL,
- `perfdata` text,
+ `perfdata` MEDIUMBLOB,
`type` tinyint(4) default NULL,
- `cookie` text,
- `post` text,
- `get` text,
+ `cookie` BLOB,
+ `post` BLOB,
+ `get` BLOB,
`pmu` int(11) default NULL,
`wt` int(11) default NULL,
`cpu` int(11) default NULL,
@@ -412,7 +412,6 @@ public function save_run($xhprof_data, $type, $run_id = null, $xhprof_details =
$sql['cpu'] = isset($xhprof_data['main()']['cpu']) ? $xhprof_data['main()']['cpu'] : '';
- //The MyISAM table type has a maxmimum row length of 65,535bytes, without compression XHProf data can exceed that.
// The value of 2 seems to be light enugh that we're not killing the server, but still gives us lots of breathing room on
// full production code.
$sql['data'] = mysqli_real_escape_string($this->linkID, gzcompress(serialize($xhprof_data), 2));
@@ -415,7 +415,6 @@ public function save_run($xhprof_data, $type, $run_id = null, $xhprof_details =
$sql['cpu'] = isset($xhprof_data['main()']['cpu']) ? $xhprof_data['main()']['cpu'] : '';
- //The MyISAM table type has a maxmimum row length of 65,535bytes, without compression XHProf data can exceed that.
// The value of 2 seems to be light enugh that we're not killing the server, but still gives us lots of breathing room on
// full production code.
$sql['data'] = addslashes(gzcompress(serialize($xhprof_data), 2));
@@ -106,11 +106,11 @@ protected function db()
`c_url` varchar(255) default NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`server name` varchar(64) default NULL,
- `perfdata` text,
+ `perfdata` MEDIUMBLOB,
`type` tinyint(4) default NULL,
- `cookie` text,
- `post` text,
- `get` text,
+ `cookie` BLOB,
+ `post` BLOB,
+ `get` BLOB,
`pmu` int(11) default NULL,
`wt` int(11) default NULL,
`cpu` int(11) default NULL,
@@ -403,7 +403,6 @@ public function save_run($xhprof_data, $type, $run_id = null, $xhprof_details =
$sql['cpu'] = isset($xhprof_data['main()']['cpu']) ? $xhprof_data['main()']['cpu'] : '';
- //The MyISAM table type has a maxmimum row length of 65,535bytes, without compression XHProf data can exceed that.
// The value of 2 seems to be light enugh that we're not killing the server, but still gives us lots of breathing room on
// full production code.
$sql['data'] = mysql_real_escape_string(gzcompress(serialize($xhprof_data), 2));
@@ -106,11 +106,11 @@ protected function db()
`c_url` varchar(255) default NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`server name` varchar(64) default NULL,
- `perfdata` text,
+ `perfdata` MEDIUMBLOB,
`type` tinyint(4) default NULL,
- `cookie` text,
- `post` text,
- `get` text,
+ `cookie` BLOB,
+ `post` BLOB,
+ `get` BLOB,
`pmu` int(11) default NULL,
`wt` int(11) default NULL,
`cpu` int(11) default NULL,
@@ -403,7 +403,6 @@ public function save_run($xhprof_data, $type, $run_id = null, $xhprof_details =
$sql['cpu'] = isset($xhprof_data['main()']['cpu']) ? $xhprof_data['main()']['cpu'] : '';
- //The MyISAM table type has a maxmimum row length of 65,535bytes, without compression XHProf data can exceed that.
// The value of 2 seems to be light enugh that we're not killing the server, but still gives us lots of breathing room on
// full production code.
$sql['data'] = mysqli_real_escape_string($this->linkID, gzcompress(serialize($xhprof_data), 2));
@@ -436,7 +436,6 @@ public function save_run($xhprof_data, $type, $run_id = null, $xhprof_details =
$sql['cpu'] = isset($xhprof_data['main()']['cpu']) ? $xhprof_data['main()']['cpu'] : '';
- //The MyISAM table type has a maxmimum row length of 65,535bytes, without compression XHProf data can exceed that.
// The value of 2 seems to be light enugh that we're not killing the server, but still gives us lots of breathing room on
// full production code.
$sql['data'] = gzcompress(serialize($xhprof_data), 2);

0 comments on commit 9af7df6

Please sign in to comment.