I'm currently trying to write a short SQL expression that will give me a rough estimate of the disk-space usage of a particular bunch of rows in a table.

For table 'example':

CREATE TABLE `example` (
  `id` int(11) NOT NULL auto_increment,
  `blah` varchar(255) NOT NULL default '',
  `blah2` longblob NOT NULL
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

... I can write a query as follows:

SELECT length(blah) + length(blah2) FROM example

This, I hope, gives me a rough idea how much space is used by the row (to get a better approximation, I could include what's listed in http://dev.mysql.com/doc/mysql/en/Storage_requirements.html, but the above would do).

Now, my questions are:
- Does length() always return a sensible value for things like length(LONGBLOB) (e.g. length(blah2))?
- Does it return the number of bytes in the blob?
- In general, will the approach shown above give a reasonable estimate of disk-space usage?


Ta,

--
Mike

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to