Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Allow using pg_repack on state_groups_state by adding a primary key or UNIQUE constraint #10308

Open
@PeterCxy

Description

Description:

It would be nice if pg_repack could be used on the state_groups_state table, which often has quite a lot of bloat after purging rooms / history. pg_repack is similar to VACUUM FULL but it can be run online without taking an exclusive lock on the tables.

pg_repack has the following requirement on the table it is run against:

Target table must have a PRIMARY KEY, or at least a UNIQUE total index on a NOT NULL column.

Currently the state_groups_state table does not have a primary key or UNIQUE NOT NULL keys. event_id seems like a great candidate for this, though I'm not sure if setting a TEXT value as primary key would have any performance implications.

EDIT: it seems that none of the columns in the table is actually unique. To allow the table to be used by pg_repack, we might need to add an auto-incrementing separate primary key.

Metadata

Assignees

No one assigned

    Labels

    A-DatabaseDB stuff like queries, migrations, new/remove columns, indexes, unexpected entries in the dbT-EnhancementNew features, changes in functionality, improvements in performance, or user-facing enhancements.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions