HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Disadvantages of unlogged tables

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
tablesunloggeddisadvantages

Problem

To make updates faster, I am using:

ALTER TABLE imagingresourceplanning.opnav_fact_revenue_costs SET UNLOGGED ;


What are the drawbacks of this command?

What will happen if system crashes during the update? Is all the data present in the table deleted? Or only the updates which are being done will be lost?

Solution

Logging is in reference to Write-Ahead-Logs.

Essentially, everything gets written ahead of time to a log. That log can be played back at any point in time if there is a problem with database constancy (crash-safety). This means data is written twice, once to the log with representation in memory, and a later point in time flushed to the table's heap.

The log can also be shipped to a slave and can play a role in point-in-time (PITR) replication.

Check out the documents on the PostgreSQL implementation of Write-Ahead logging for more information.

If the system crashes (not shut down cleanly), the contents of unlogged tables will be deleted as stated in the manual:

However, they are not crash-safe: an unlogged table is automatically truncated after a crash or unclean shutdown

Context

StackExchange Database Administrators Q#190228, answer score: 6

Revisions (0)

No revisions yet.