I’ve been toying around a bit with storage engines and found the archive storage engine to be quite suitable for Yii’s logs. INSERTs are pretty fast and all data is being compressed. The drawbacks are that you cannot delete single rows (TRUNCATE won’t work either. You’ve got to recreate the entire table) and there are no indices apart from a primary key (IIRC, AUTO_INCREMENT primary keys are being available since MySQL v5.1.6).
I’d like to hear what others are thinking of this. I am tempted to put this into production for error- and warning-level messages. If you would like to test this yourself, either modify your existing table
ALTER TABLE `YiiLog` ENGINE=ARCHIVE;
or create a new one:
CREATE TABLE `YiiLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `level` varchar(128) DEFAULT NULL, `category` varchar(128) DEFAULT NULL, `logtime` int(11) DEFAULT NULL, `message` text, PRIMARY KEY (`id`) ) ENGINE=ARCHIVE;