-
I'm trying to understand the design decisions behind how Neon handles unlogged and temporary tables. From what I see, Neon persists unlogged tables using local storage. To support this, there are some changes in the PostgreSQL codebase:
My question is: If checking the disk is considered too expensive, couldn't we use the Relation Cache hashtable (which PostgreSQL already uses to cache relation structs)? This cache includes the relpersistence value, and if a lookup misses, PostgreSQL already scans the pg_class table to populate it. To avoid the table scan, we could fall back to checking for the file on disk. In summary: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
It would be expensive
Isn't that exactly what the code does today? |
Beta Was this translation helpful? Give feedback.
Postgres relcache is private to backend and is filled when relation is opened. And in this case do not need to guess relation persistence - it is passed to SMGR. The only problem is when page is evicted from shared buffer but this relation wasn't yet accessed by this backend. In this case persistence is unknown and this is why we have to use our own relopersistence cache.