How do you optimize the disk IO when you cannot assume a file will start at a boundary then? - Mailing list pgsql-general

From Siddharth Jain
Subject How do you optimize the disk IO when you cannot assume a file will start at a boundary then?
Date
Msg-id CAPqV3pSfV-ALnjH1o9Ha8m8D0x72Koat+7KcXCSjk_p-1e6L1g@mail.gmail.com
Whole thread Raw
Responses Re: How do you optimize the disk IO when you cannot assume a file will start at a boundary then?  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
Re: How do you optimize the disk IO when you cannot assume a file will start at a boundary then?  (Thomas Munro <thomas.munro@gmail.com>)
List 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.

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

pgsql-general by date:

Previous
From: Nandhini Jayakumar
Date:
Subject: Discover PostgreSQL's Graph Power with Apache AGE!
Next
From: Sasmit Utkarsh
Date:
Subject: Postgresql assistance needed