4 ms·
It is a crime that postgres isn't able to allocate with 1GB huge pages by changing a config parameter in 2026 Also a crime that people are still running databa
by ozgrakkurt 6mo ago
It is a crime that postgres isn't able to allocate with 1GB huge pages by changing a config parameter in 2026
Also a crime that people are still running databases with 4kb pages.
To put it in perspective, this means you will have more than 30 million pages on a server with 128GB RAM. As an example, if there is 16bytes of metadata for memory page. The metadata itself would take more than half a gigabyte.
- bonzini 6mo agoThere is 64 bytes of metadata per memory page indeed.
- dezgeg 6mo agoEven worse, the actual struct page on Linux is 64 bytes, so 4x your example
- andrewstuart 6mo agoSensible defaults would be nice.
- ldargin 6mo agoDatabase systems lock pages when writing to them, to maintain integrity. Using 1GB pages would cause excessive blocking in many if not most transactional databases.
- jlokier 6mo agoIn database engines that use page locks, the locked page size can be different from the file/mapped/allocated page sizes. If you still have excessive locking while using smaller page locks, there are other ways to reduce contention as well, such as CoW to protect concurrent reads, deferred write-merging to assist concurrent writes, and the storage equivalent of RCU.
- andrewf 6mo agoI don't think hardware page size has to match database page size. It would if Postgres was mmap'ing it. https://www.postgresql.org/docs/current/runtime-config-preset.html https://www.postgresql.org/docs/current/runtime-config-prese... says the database page size is 8KB by default.
- anarazel 6mo ago> It is a crime that postgres isn't able to allocate with 1GB huge pages by changing a config parameter in 2026 It is able to? Configure huge_page_size=1GB? Support for 2MB pages was added in 2014, for larger pages 2020. Edit: year details.
- ozgrakkurt 6mo agoDidn't know that, thanks. Sorry for the wrong comment.