zlacker

[parent] [thread] 2 comments
1. osigur+(OP)[view] [source] 2021-06-12 15:01:36
My understanding is, UNLOGGED means that changes are not written to the WAL and data can be lost in the event of an unscheduled shutdown. It doesn't mean that the table only exists in memory however - the data is still eventually persisted to disk.
replies(1): >>truth_+12
2. truth_+12[view] [source] 2021-06-12 15:17:52
>>osigur+(OP)
From the official doc link i shared already:

UNLOGGED

If specified, the table is created as an unlogged table. Data written to unlogged tables is not written to the write-ahead log (see Chapter 29), which makes them considerably faster than ordinary tables. However, they are not crash-safe: an unlogged table is automatically truncated after a crash or unclean shutdown. The contents of an unlogged table are also not replicated to standby servers. Any indexes created on an unlogged table are automatically unlogged as well.

replies(1): >>andrew+D3
◧◩
3. andrew+D3[view] [source] [discussion] 2021-06-12 15:34:05
>>truth_+12
Uh, yeah, that confirms what osigurdson said, not that they're in-memory. For that IIRC you need to mount a ram-disk in your OS and put the table on that. Definitely also make it UNLOGGED, though.
[go to top]