Add PostgresTableSize
Ref: #477398 (closed)
What does this MR do and why?
This MR adds a new model to keep track of table size.
It will be used to identify tables over a given threshold and apply new upcoming restrictions to contain our current growth.
We will use this data in DB Lab clone and automatically update the tables in the database dictionaries.
gitlabhq_development_ci=# SELECT * FROM postgres_table_sizes limit 1;
identifier | schema_name | table_name | total_size | table_size | index_size | size_in_bytes
-----------------+-------------+------------+------------+------------+------------+---------------
public.projects | public | projects | 472 kB | 0 bytes | 472 kB | 483328
(1 row)
[1] pry(main)> Gitlab::Database::PostgresTableSize.first
=> #<Gitlab::Database::PostgresTableSize:0x0000000164a18348 identifier: "gitlab_partitions_dynamic._test__20241107", schema_name: "gitlab_partitions_dynamic", table_name: "_test__20241107", total_size: "8192 bytes", table_size: "0 bytes", index_size: "8192 bytes", size_in_bytes: 8192>
Edited by Max Orefice