Hi,
I was calculating row sizes with pg_column_size and came to this strange
result:
CREATE TABLE t1(
c1 NUMERIC(10,7) NOT NULL DEFAULT 123.1234567
);
INSERT INTO t1(c1) VALUES (DEFAULT);
SELECT pg_column_size(c1) AS first,
pg_column_size(123.1234567::NUMERIC(10,7)) as second, c1 =
123.1234567::NUMERIC(10,7) AS are_equal
FROM t1;
+-------+--------+-----------+
| first | second | are_equal |
+-------+--------+-----------+
| 9 | 12 | t |
+-------+--------+-----------+
Is there a reason pg_column_size returns different sizes for a constant
and the same value from a table column?
Regards,
Mladen Marinović
marin@kset.org writes:
> Is there a reason pg_column_size returns different sizes for a constant
> and the same value from a table column?
The constant probably has the default choice of a four-byte length word,
while the on-disk form has been compressed by switching to a one-byte
length word.
regards, tom lane
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера