Return the number of bytes used to store a value in its internal representation.
PG_COLUMN_SIZE(expr)
## Overview Returns the number of bytes used to store the given value in DeltaForge's internal representation. Use this function to estimate table size, identify unusually large values, or build storage-efficiency reports. The measurement reflects the internal encoding, which may differ from the on-disk size after compression. ## Behavior - Returns NULL if the input is NULL. - Returns an INT byte count. - For variable-length types (strings, arrays), the result depends on the actual value length. - Deterministic with respect to the input value. - Side effect free. ## Compatibility - PG-compat alias for `pg_column_size` function.
| Name | Type | Description |
|---|---|---|
expr | Specifies the expression whose internal storage size is measured. |
-- Size of a small integer
SELECT PG_COLUMN_SIZE(42);
-- Size of a short string
SELECT PG_COLUMN_SIZE('hello world');
-- Compare sizes across numeric types
SELECT PG_COLUMN_SIZE(1::SMALLINT) AS small, PG_COLUMN_SIZE(1::BIGINT) AS big;
-- Per-column size statistics in a report
SELECT PG_COLUMN_SIZE(name) AS name_bytes, PG_COLUMN_SIZE(description) AS desc_bytes
FROM retail.catalog.products;
-- NULL input returns NULL
SELECT PG_COLUMN_SIZE(NULL); -- NULL