public inbox for [email protected]
help / color / mirror / Atom feedFrom: [email protected]
To: [email protected]
Subject: Re: Postgres do not support tinyint?
Date: Fri, 10 Jan 2025 11:44:29 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAFCRh-87K0kLsXFSYeTj1xZvG-maq0qv4eRVt5iMs2j-6LNBMQ@mail.gmail.com>
References: <CA+FnnTzfvgVdptHcLBFPrq_Q+xPes-Bhjiw_xFiooq4VqhqyrQ@mail.gmail.com>
<CANzqJaCxZK0j8fL-riZpX+AV+kyo9PcAvgF=H5DgaWK+C+66Vw@mail.gmail.com>
<CAKFQuwYYgPxUSvo2UzOty5Cd1xw5+2q1bg3+zY-nsXNZyq+_4g@mail.gmail.com>
<[email protected]>
<CA+FnnTxf3VxTPzGFy7q-6ENVcV769F_5_=nbGOvK40qua8XPgg@mail.gmail.com>
<[email protected]>
<CA+FnnTyxnWjjaC4dDo6Y4DeCYAVa3dgGdsMg3sdTOFiyHAG7Ag@mail.gmail.com>
<[email protected]>
<CAFCRh-87K0kLsXFSYeTj1xZvG-maq0qv4eRVt5iMs2j-6LNBMQ@mail.gmail.com>
Dominique Devienne schrieb am 10.01.2025 um 10:41:
> On Fri, Jan 10, 2025 at 10:13 AM Vladlen Popolitov
> <[email protected]> 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
view thread (3+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Postgres do not support tinyint?
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox