How do you optimize the disk IO when you cannot assume a file will start at a boundary then?

From: Siddharth Jain <siddhsql(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: How do you optimize the disk IO when you cannot assume a file will start at a boundary then?
Date: 2024-02-22 01:22:47
Message-ID: CAPqV3pSfV-ALnjH1o9Ha8m8D0x72Koat+7KcXCSjk_p-1e6L1g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi All,

I understand the storage layer in databases goes to great lengths to ensure:
- a row does not cross a block boundary
- read/writes/allocation happen in units of blocks
etc. The motivation is that at the OS level, it reads and writes pages
(blocks), not individual bytes. I am only concerned about SSDs but I think
the principle applies to HDD as well.

but how can we do all this when we are not even guaranteed that the
beginning of a file will be aligned with a block boundary? refer this
<https://stackoverflow.com/questions/8018449/is-it-guaranteed-that-the-beginning-of-a-file-is-aligned-with-pagesize-of-file-s>
.

Further, I don't see any APIs exposing I/O operations in terms of blocks.
All File I/O APIs I see expose a file as a randomly accessible contiguous
byte buffer. Would it not have been easier if there were APIs that exposed
I/O operations in terms of blocks?

can someone explain this to me?

Sid

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sasmit Utkarsh 2024-02-22 08:31:56 Postgresql assistance needed
Previous Message Nandhini Jayakumar 2024-02-21 22:42:59 Discover PostgreSQL's Graph Power with Apache AGE!