telegram icon indicating copy to clipboard operation
telegram copied to clipboard

Database size continuously grows

Open turt2live opened this issue 5 years ago • 1 comments

For context, here's a 16gb database:

telegram=# \d+
                                   List of relations
 Schema |             Name             |   Type   |  Owner   |    Size    | Description
--------+------------------------------+----------+----------+------------+-------------
 public | alembic_version              | table    | telegram | 8192 bytes |
 public | bot_chat                     | table    | telegram | 136 kB     |
 public | bot_chat_id_seq              | sequence | telegram | 8192 bytes |
 public | contact                      | table    | telegram | 20 MB      |
 public | message                      | table    | telegram | 4827 MB    |
 public | mx_room_state                | table    | telegram | 14 MB      |
 public | mx_user_profile              | table    | telegram | 325 MB     |
 public | portal                       | table    | telegram | 4416 kB    |
 public | puppet                       | table    | telegram | 210 MB     |
 public | puppet_id_seq                | sequence | telegram | 8192 bytes |
 public | telegram_file                | table    | telegram | 814 MB     |
 public | telethon_entities            | table    | telegram | 437 MB     |
 public | telethon_sent_files          | table    | telegram | 8192 bytes |
 public | telethon_sessions            | table    | telegram | 22 MB      |
 public | telethon_update_state        | table    | telegram | 616 kB     |
 public | telethon_version             | table    | telegram | 0 bytes    |
 public | telethon_version_version_seq | sequence | telegram | 8192 bytes |
 public | user                         | table    | telegram | 11 MB      |
 public | user_portal                  | table    | telegram | 96 MB      |
(19 rows)

Some of the tables feel like they could be pruned/purged every so often:

telegram=# select count(*) from telegram_file;
s  count
---------
 4937760
(1 row)

telegram=# select count(*) from message;
  count
----------
 44211779
(1 row)

turt2live avatar Feb 15 '20 01:02 turt2live

Exactly, any idea how to prevent this size growth?

erfanoabdi avatar Dec 17 '22 18:12 erfanoabdi