#5546 - cms_stats table takes too much space

Identifier #5546
Issue type Feature request or suggestion
Title cms_stats table takes too much space
Status Open
Tags

Risk: Database change (custom)

Handling member Deleted
Addon stats
Description When I designed this table, I didn't realize varchar's reserve space for maximum char lengths, in order for record sizes to be regular.

This query reduces it by about 25%:
ALTER TABLE cms_stats MODIFY COLUMN the_page VARCHAR(100), MODIFY COLUMN session_id VARCHAR(15), MODIFY COLUMN operating_system VARCHAR(190);

(Composr's database schema check tool will complain about this, but I verified it is okay by checking field lengths in the existing data set)

For us to do this properly we'd need to align to Composr's meta-DB field lengths, possibly adding new ones. Or, gasp, allowing custom length values (lots of work).

Also, other DB systems store IPs as numeric values as it saves a lot of space. We could consider that.

All this said, I actually reduced table usage down to 1/25th the original size because I think the table needed to be re-optimised (changing field types did that as a side effect). So another consideration is to somehow run optimisations automatically. I'm not sure if there's a good way to do that on MySQL without downtime, but a few minutes of downtime every month or so may be okay to stop the site going down like 2 hours due to lack of disk space like it did for me this morning.
Steps to reproduce

Funded? No
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".

Rating

Unrated