Dino Geek, try to help you

How to compress MariaDB tables to save disk space?


Compressing tables in MariaDB is a way to save disk space, especially if the amount of data is quite large. It’s important to note that, while this can save you space, it also can result in slower queries because the data must be decompressed before it can be read.

You can use the Aria storage engine’s page compression feature to compress the tables. Here’s a sample SQL statement to do this:

```
ALTER TABLE table_name ROW_FORMAT=PAGE, PAGE_COMPRESSED=1;
```

You will need to replace “table\_name” with the name of your actual table.

Alternatively, you can use InnoDB compression using the following steps:

1. Check if your version of MariaDB supports InnoDB (It should if your version is newer than 10.0.5).

1. Make sure the `innodb_file_per_table` setting is ON.

1. Next, you can compress a table using the following command after substituting your actual table name:

\`\`\`SQL
ALTER TABLE table_name ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
\`\`\`

Remember to back up your data before performing these kinds of operations.

Also, depending on your requirements, adjusting the `KEY_BLOCK_SIZE` parameter might be beneficial. Smaller values result in better compression, but can cause slower queries due to a smaller portion of the compressed data in memory.

Good compression and disk space savings can frequently be achieved with a `KEY_BLOCK_SIZE` of 4 or 8 when compressing InnoDB tables.

Keep in mind that the performance impact of table compression can vary depending on your workload and hardware, so, test your database after compressing tables to ensure that performance remains acceptable.


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use