News for hackers. Stuff that matters.
Re:How PostgreSQL stores rows by didip on Wednesday February 09, 2022 @08:34PM (#30281381)
I would love to learn from database experts here:

Why some databases choose to use segment files as persistence and why some other databases choose to use key-value as persistence?

From my perspective, using key-value is very convenient because you can then outsource persistence to a distributed, fault tolerant, key-value storage.

Re:How PostgreSQL stores rows by mdavidn on Wednesday February 09, 2022 @09:31PM (#30281763)
Many query plans (e.g. sorts, joins, aggregation) involve scanning large swaths of data. The importance of sequential access for such operations cannot be overstated. Storage, processors, and networks are designed to make sequential access performant.

Some SQL databases are backed by key-values stores, but they generally store large segments in the values rather than individual records. (e.g. Snowflake, Athena)

Re:How PostgreSQL stores rows by polskibus on Thursday February 10, 2022 @05:26AM (#30284429)
Segments also allow you to store some info about segment statistics, for example min and max for each numeric column which allow optimiser to skip entire segments when filtering. More tricks can be found in Snowflake paper.
Re:How PostgreSQL stores rows by Something1234 on Wednesday February 09, 2022 @08:47PM (#30281485)
There was another article posted today about LSM trees, and how they use segment files. I think at the end of the day the "distributed, fault tolerant, key-value storage" is using segment files too. By having your database use segment files directly you're just skipping a middleman.
Re:How PostgreSQL stores rows by binarray2000 on Thursday February 10, 2022 @01:34AM (#30283052)
Re:How PostgreSQL stores rows by dikei on Wednesday February 09, 2022 @09:22PM (#30281709)
There are no conflict: key-value is an interface, segment files is an implementation. You can implement a key-value using segment files too.
Re:How PostgreSQL stores rows by radiowave on Wednesday February 09, 2022 @08:49PM (#30281503)
Not sure that I qualify as an expert, but in the case of Postgres the choice was probably influenced by the fact that readily available, distributed, fault tolerant, key-value storage wouldn't exist for at least another decade.
Re:How PostgreSQL stores rows by inopinatus on Wednesday February 09, 2022 @09:22PM (#30281713)
It's all very well until you discover the distributed, fault-tolerant, key-value storage is implemented using a database.
Re:How PostgreSQL stores rows by jimbokun on Wednesday February 09, 2022 @11:24PM (#30282435)
But what if that database is using a key value store?
Re:How PostgreSQL stores rows by inopinatus on Wednesday February 09, 2022 @11:52PM (#30282570)
it's turtles all the way down
Re:How PostgreSQL stores rows by kklisura on Thursday February 10, 2022 @04:02AM (#30283882)
it's tuples all the way down
Re:How PostgreSQL stores rows by inopinatus on Friday February 11, 2022 @04:37PM (#30307313)
perfect, thank you