我有 2 个表,其中包含以下模式,行数相等。当我运行SELECT relname, relpages FROM pg_class ORDER BY relpages DESC
命令时,它们显示为 23GB,即使这两个模式的数据类型(总字节数)导致大小不同。找出通过组合表格可以节省多少空间的最佳方法是什么?另外,有什么方法可以确定每行实际占用多少空间?
Table "public.table1"
Column | Type | Modifiers
--------------+--------------------------+-----------------------------------------------------
field1 | smallint |
field2 | smallint |
field3 | integer |
field4 | smallint |
timestamp | timestamp with time zone |
user_id | integer |
status | boolean |
id | integer | not null default
Table "public.table2"
Column | Type | Modifiers
----------------+--------------------------+----------------------------------------------------
user_id | integer |
begin_timestamp | timestamp with time zone |
end_timestamp | timestamp with time zone |
field | smallint | not null
id | integer | not null default