mirror of
https://github.com/weewx/weewx.git
synced 2026-05-18 23:05:30 -04:00
SQLite creates a unique index in addition to the clustered index for `INTEGER NOT NULL UNIQUE PRIMARY KEY` columns. The index is not necessary to enforce uniqueness and is not used for existing queries. Removing these unnecessary indexes reduced my database from 444MB to 395MB (11%). Remove the `UNIQUE` constraint from `INTEGER PRIMARY KEY` columns to avoid the unnecessary overhead. Note: Testing with MariaDB 11.8.3 indicates that the `UNIQUE` constraint is ignored (`SHOW CREATE TABLE` does not include `UNIQUE` and `SHOW INDEX` only shows a `PRIMARY` index.) Removing it will have no effect that I am aware of for MariaDB. Fixes: #1031 Signed-off-by: Kevin Locke <kevin@kevinlocke.name>