Re: Postgres do not support tinyint?

Поиск
Список
Период
Сортировка
От shammat@gmx.net
Тема Re: Postgres do not support tinyint?
Дата
Msg-id b6a65a6c-76af-4ab3-a9ee-5ba0019da9ca@gmx.net
обсуждение исходный текст
Ответ на Re: Postgres do not support tinyint?  (Dominique Devienne <ddevienne@gmail.com>)
Список pgsql-general
Dominique Devienne schrieb am 10.01.2025 um 10:41:
> On Fri, Jan 10, 2025 at 10:13 AM Vladlen Popolitov
> <v.popolitov@postgrespro.ru> wrote:
>> If you really need 1-byte integer, you can use "char" type. Cast it
>> to/from int. See comment at the end of the page
>> https://www.postgresql.org/docs/17/datatype-character.html
>
> Hi. What would be the best online doc to learn about the physical
> storage / format for rows/pages/btree, etc... To understand alignment,
> packing, varint or not, all those things. I'm quite familiar with the
> [SQLite format][1], having read that doc dozens of times, and I'd like
> a better low-level understanding for PostgreSQL as well. TIA, --DD

The alignment requirement of each type is available in pg_type

https://www.postgresql.org/docs/current/catalog-pg-type.html

The physical layout on disk is described here:

https://www.postgresql.org/docs/current/storage.html

And the "Postgres intenrals" site might be helpful as well:

https://www.interdb.jp/pg/pgsql01.html


There are various (blog) posts on how to optimize space considering alignment

* https://stackoverflow.com/a/7431468
* https://www.enterprisedb.com/blog/rocks-and-sand

The "postgres_dba" toolset has a little SQL script to evaluate the space savings:

https://github.com/NikolayS/postgres_dba/blob/master/sql/p1_alignment_padding.sql





В списке pgsql-general по дате отправления: