Checkpoint writes dirty pages from buffer pool to disk and updates WAL with a redo start point
Reduces crash recovery time from hours to seconds by avoiding full WAL replay
Sharp checkpoints write all dirty pages synchronously (slow but clean); fuzzy checkpoints spread writes over time (faster but complex)
In PostgreSQL, checkpoint_timeout and checkpoint_completion_target control frequency and I/O impact
Production gotcha: too frequent checkpoints cause I/O storms; too infrequent cause long recovery
✦ Definition~90s read
What is Checkpoint in DBMS?
A checkpoint in a DBMS is a synchronization point where the buffer pool's dirty pages (modified but not yet on disk) are flushed to the data files, and the WAL is updated to mark that all changes up to that point are safely stored. This drastically shortens crash recovery: instead of replaying the entire WAL from the beginning, the database can start from the most recent checkpoint.
★
Imagine you're doing a 500-piece jigsaw puzzle and you stop every hour to take a photo of your progress.
The checkpoint record in the WAL contains the LSN (Log Sequence Number) that acts as the new recovery start point.
Checkpoints are not optional – every ACID-compliant database implements them. Without checkpoints, recovery time would grow linearly with the age of the database. A ten-year-old database would need to replay ten years of transactions after each restart. That simply doesn't work at scale.
Plain-English First
Imagine you're doing a 500-piece jigsaw puzzle and you stop every hour to take a photo of your progress. If the dog jumps on the table and scatters everything, you restart from the photo — not from the empty table. A database checkpoint is exactly that photo: a confirmed 'safe point' on disk so that after a crash, the database only has to redo work done after the last photo, not replay every single move since it was first installed.
⚙ Browser compatibility
Latest versions — ✓ supported
Chrome
Firefox
Safari
Edge
✓
✓
✓
✓
Every production database — Postgres, MySQL InnoDB, Oracle, SQL Server — will crash at some point. Power cuts happen. Kernel panics happen. Someone trips over the wrong cable. The question isn't if your database will die mid-transaction; it's how fast it can get back on its feet with zero data loss. That answer lives almost entirely in one mechanism: the checkpoint.
Without checkpoints, crash recovery means replaying every single log record ever written — potentially years of transactions — before the database can accept a single query. That would make restarts take hours or days. Checkpoints solve this by periodically writing all dirty pages from memory to disk and recording a 'you can start recovery from here' marker in the write-ahead log. That single act turns a potential multi-hour recovery into seconds.
By the end of this article you'll understand exactly what happens inside a checkpoint cycle, the difference between sharp and fuzzy checkpoints and why fuzzy ones exist, how the WAL and buffer pool interact during checkpointing, what the performance trade-offs look like in PostgreSQL's real configuration knobs, and the production gotchas that bite engineers who treat checkpoints as a background detail.
What Is a Checkpoint and Why Does It Exist?
A checkpoint in a DBMS is a synchronization point where the buffer pool's dirty pages (modified but not yet on disk) are flushed to the data files, and the WAL is updated to mark that all changes up to that point are safely stored. This drastically shortens crash recovery: instead of replaying the entire WAL from the beginning, the database can start from the most recent checkpoint. The checkpoint record in the WAL contains the LSN (Log Sequence Number) that acts as the new recovery start point.
Checkpoints are not optional – every ACID-compliant database implements them. Without checkpoints, recovery time would grow linearly with the age of the database. A ten-year-old database would need to replay ten years of transactions after each restart. That simply doesn't work at scale.
checkpoint_basics.sqlPOSTGRESQL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
-- PostgreSQL: Checkpoint in action
-- This triggers a manual checkpoint
CHECKPOINT;
-- Check checkpoint-related statistics
SELECT checkpoints_timed, checkpoints_req,
buffers_checkpoint, buffers_clean, buffers_backend,
checkpoint_write_time, checkpoint_sync_time
FROM pg_stat_bgwriter;
-- Show last checkpoint location
SELECTpg_current_wal_lsn(),
pg_last_checkpoint_location() AS last_checkpoint_lsn,
pg_last_checkpoint_timestamp();
Mental Model
Checkpoint as Snapshot
A checkpoint is like a save point in a video game — after a crash, you restart from the last save, not from level one.
Dirty pages = unsaved progress; checkpoint = save to disk.
WAL = a journal of every action; checkpoint = a bookmark in the journal saying 'everything before this is safe'.
Recovery scans the WAL from the checkpoint forward, not from the beginning — that's the speed gain.
Without checkpoints, recovery time equals database age. With them, it's bounded by the checkpoint interval.
📊 Production Insight
If checkpoint_timeout is too long, recovery takes longer — but too short causes I/O thrashing.
Set checkpoint_completion_target between 0.7 and 0.9 to spread writes evenly.
Monitor buffers_checkpoint vs buffers_backend — backend writes signal checkpoint pressure.
🎯 Key Takeaway
Checkpoints are the reason databases recover in seconds, not days.
Tuning checkpoint parameters balances I/O load vs recovery speed.
Always measure your current checkpoint behavior before changing config.
thecodeforge.io
Checkpoint Dbms
WAL and Checkpoint Interaction: The Recovery Handshake
The Write-Ahead Log (WAL) records every change before it's applied to data files. A checkpoint ensures that all WAL records up to a certain LSN have been fully applied to the data files on disk. After checkpoint, the WAL can be truncated up to that LSN. During recovery, the database reads the last checkpoint location from the WAL and replays all subsequent records. This is called the redo phase. Some databases also have an undo phase to roll back incomplete transactions.
The key insight: the checkpoint record itself is written after all dirty pages are safely on disk. If the checkpoint record is missing, recovery falls back to the previous checkpoint. That's why checkpoint writes are synchronous and include a WAL flush. The checkpoint writes use direct I/O to ensure persistence.
wal_interaction.sqlPOSTGRESQL
1
2
3
4
5
6
7
8
9
10
11
-- Show where the last checkpoint is in the WALSELECTpg_last_checkpoint_location() AS checkpoint_lsn;
-- Show the LSN of a recent transaction
SELECTtxid_current(), pg_current_wal_lsn();
-- After a checkpoint, old WAL segments are reusable
SELECTpg_switch_wal(); -- ForceWAL segment switchCHECKPOINT;
-- Now inspect WAL directory
SELECT * FROMpg_ls_waldir() ORDERBY name;
🔥WAL Archiving and Checkpoints
In production, WAL is archived for Point-in-Time Recovery (PITR). Checkpoints coordinate with archivers to ensure archived WAL is contiguous. If archive_command is slow, checkpoints may stall, causing transaction lag.
📊 Production Insight
A checkpoint can stall if WAL archiving is falling behind.
Monitor pg_stat_archiver for failed archiving jobs.
The rule: checkpoint cannot complete until all preceding WAL is archived if archive_mode = on.
🎯 Key Takeaway
Checkpoint writes a 'safe up to here' marker in WAL.
Recovery replays WAL from that marker.
If WAL archiving fails, checkpoints block — preventing new WAL segment reuse.
Sharp vs Fuzzy Checkpoints: The Performance Trade-off
Sharp checkpoints flush all dirty pages at one moment. This is simple but causes a massive I/O spike. Fuzzy checkpoints (used by PostgreSQL, MySQL InnoDB) spread the flushing over a configurable window. They start writing dirty pages early in the interval and try to complete before the next checkpoint. The WAL checkpoint record marks the boundary, but data writes are asynchronous.
In PostgreSQL, checkpoint_completion_target controls how much of the interval is used for flushing. A value of 0.9 means 90% of checkpoint_timeout is spent writing dirty pages, with the final 10% reserved for the sync. This avoids a sudden burst but requires a steady I/O capacity.
Sharp checkpoints still exist in some systems (e.g., SQL Server simple recovery model), but modern systems prefer fuzzy for stability.
checkpoint_configuration.sqlPOSTGRESQL
1
2
3
4
5
6
7
8
9
10
11
12
13
-- View current checkpoint parameters
SHOW checkpoint_timeout;
SHOW checkpoint_completion_target;
SHOW max_wal_size;
SHOW min_wal_size;
-- Example: configure for a heavy-write workload
ALTERSYSTEMSET checkpoint_timeout = '10min';
ALTERSYSTEMSET checkpoint_completion_target = 0.9;
ALTERSYSTEMSET max_wal_size = '4GB';
ALTERSYSTEMSET min_wal_size = '1GB';
-- Reload configuration
SELECTpg_reload_conf();
Mental Model
Fuzzy Checkpoint Analogy
Fuzzy checkpoint is like a marathon runner pacing themselves instead of sprinting a mile and collapsing.
Sharp = sprint: all writes at once, I/O spike, fast but painful.
Fuzzy = steady jog: writes spread over minutes, smooth I/O, easier on disk.
Completion target = your pace plan: how much of the interval you use.
Database replay doesn't care about fuzziness — it only looks at the LSN boundary.
📊 Production Insight
Fuzzy checkpoints are essential in high-write environments.
If checkpoint_completion_target is too high (>0.95), the checkpoint may not finish before the next one starts.
If too low (<0.5), I/O spikes occur because flushing is compressed into a short time.
🎯 Key Takeaway
Fuzzy checkpoints smooth I/O but need careful completion target tuning.
Sharp checkpoints are simple but not production-friendly in write-heavy systems.
Goal: finish checkpoint just before the next timeout — not too early, not too late.
thecodeforge.io
Checkpoint Dbms
Checkpoint Tuning in PostgreSQL: Real Knobs and Constraints
PostgreSQL provides several knobs to control checkpoint behaviour. The most important are:
checkpoint_timeout: Maximum time between automatic checkpoints (default 5 minutes).
max_wal_size: Target for total WAL size. When exceeded, a checkpoint is forced.
min_wal_size: Minimum WAL size to keep for recycling.
checkpoint_completion_target: Fraction of checkpoint_timeout spent flushing dirty pages.
checkpoint_flush_after: Number of pages after which to flush writes to OS.
Understanding the interaction: checkpoints can be triggered by time (timed checkpoints) or by WAL size (requested checkpoints). The pg_stat_bgwriter view shows how many of each occurred. A high ratio of requested to timed means the WAL size is often hitting max_wal_size — that can signal write bursts or insufficient max_wal_size.
checkpoint_analyze.sqlPOSTGRESQL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
-- Analyze checkpoint effectiveness
SELECT
(checkpoints_timed + checkpoints_req) AS total_checkpoints,
checkpoints_timed,
checkpoints_req,
buffers_checkpoint,
buffers_clean,
buffers_backend,
(buffers_backend * 100.0 / NULLIF(buffers_checkpoint, 0)) AS backend_write_ratio
FROM pg_stat_bgwriter;
-- Checkif checkpoints are being forced by WAL size
SELECT * FROM pg_stat_bgwriter
WHERE checkpoints_req > checkpoints_timed;
-- View current WAL size
SELECTpg_size_pretty(SUM(size)) FROMpg_ls_waldir();
📊 Production Insight
PostgreSQL 9.6+ introduced checkpoint_flush_after to reduce dirty page accumulation.
If you see long checkpoint_sync_time, consider using a faster SSD or tuning checkpoint_completion_target.
Never set max_wal_size too small — it leads to constantly forced checkpoints and WAL recycling overhead.
🎯 Key Takeaway
Monitor pg_stat_bgwriter to detect checkpoint pressure.
Timed checkpoints are cheaper than requested ones.
I/O capability determines your checkpoint interval — not the other way around.
Choosing Checkpoint Settings
IfHigh write workload, I/O capacity is limited
→
UseIncrease checkpoint_timeout to 10-15 min and set checkpoint_completion_target to 0.9.
IfLow write workload, need fast recovery
→
UseKeep checkpoint_timeout low (2-5 min) to minimize recovery time.
IfCheckpoints are requested more often than timed
→
UseIncrease max_wal_size or reduce write rate. Check for long-running transactions blocking WAL recycling.
UseCheckpoint interval is too long — increase checkpoint frequency or improve checkpointer's I/O speed.
Common Checkpoint Mistakes and How to Fix Them
Even experienced DBAs misconfigure checkpoints. The most common issues:
Using default settings in production: Default checkpoint_timeout=5min may be fine for dev but causes I/O spikes in heavy-load production. Always baseline I/O and adjust.
Ignoring full_page_writes: PostgreSQL writes full page images to WAL during first modification after a checkpoint. Disabling this saves space but risks page corruption on crash. Only disable on replicas with data checksums.
Setting checkpoint_completion_target >0.95: Leaves no buffer for OS I/O delays. A checkpoint that doesn't complete before the next timeout triggers a forced sync, causing a sharp I/O spike.
Not monitoring buffers_backend: If backend processes are writing dirty pages themselves, the checkpointer is overwhelmed. Increase checkpoint_timeout or add I/O capacity.
📊 Production Insight
Checkpoint-related I/O storms are the #1 cause of 'unexplained' performance degradation in PostgreSQL.
Always add checkpointer dedicated cores if workload is write-heavy.
Use pg_test_timing to measure checkpoint timing overhead.
🎯 Key Takeaway
Default checkpoint settings are for development — not for production.
Watch buffers_backend in pg_stat_bgwriter — that's where hidden pressure lives.
Full page writes are not optional on primary; disable only on replicas with checksums.
Checkpoint Impact on Recovery Time: Why a 5-Minute Checkpoint Can Mean 30-Minute Recovery
When a junior asks why recovery takes so long after a crash, the answer isn't magic—it's checkpoint frequency. Every dirty page not yet flushed to disk must be replayed from the WAL during recovery. The checkpoint record is the starting line for that replay. If your checkpoint interval is 5 minutes, you risk replaying up to 5 minutes of transactions. In high-throughput systems, that's gigabytes of WAL. Recovery time grows linearly with the distance from the last checkpoint. The real pain hits when you have a burst of writes just before the crash—your last checkpoint can be minutes old, and the system spends that entire time scanning and replaying. The fix isn't simply cranking up checkpoint frequency; that creates its own overhead. You need to match your checkpoint interval to your acceptable recovery time objective (RTO). A rule I've learned the hard way: if you can't afford 10 minutes of recovery, don't let your checkpoint drift past 5 minutes. Measure your WAL generation rate, calculate the redo work, and set that interval with purpose.
estimate_recovery_time.pyPYTHON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// io.thecodeforge
import psycopg2
defget_recovery_estimate(conn):
"""Estimate recovery time from last checkpoint."""
cur = conn.cursor()
# Get last checkpoint WAL position
cur.execute("""
SELECT redo_lsn, redo_wal_size
FROM pg_stat_bgwriter
""")
redo_lsn, redo_wal_size = cur.fetchone()
# Current WAL write position
cur.execute("SELECT pg_current_wal_lsn()")
current_lsn = cur.fetchone()[0]
# Bytes of WAL to replay (simplified)
bytes_behind = pg_lsn_diff(current_lsn, redo_lsn)
# Assume 100 MB/s replay speed (SSD)
replay_speed_mbps = 100
seconds = (bytes_behind / (1024 * 1024)) / replay_speed_mbps
print(f"WAL to replay: {bytes_behind / 1e6:.1f} MB")
print(f"Estimated recovery: {seconds:.1f} seconds")
return seconds
Output
WAL to replay: 450.2 MB
Estimated recovery: 4.5 seconds
⚠ Production Trap:
Don't assume default checkpoint settings match your workload. PostgreSQL defaults to 5 minutes, but if your write rate spikes, you can stack up gigabytes of dirty buffers. Always monitor pg_stat_bgwriter for checkpoint_write_time exceeding your recovery budget.
🎯 Key Takeaway
Recovery time is bounded by the time since the last checkpoint. Set checkpoint intervals to match your RTO, not your comfort.
Fuzzy Checkpoints in Action: How PostgreSQL Actually Writes Dirty Pages
Sharp checkpoints are the dream—stop the world, write everything, proceed. Real databases use fuzzy checkpoints because they don't block writes. Here's how it works in PostgreSQL: a background process (checkpointer) scans the shared buffer pool, writing all dirty pages to disk. But it doesn't hold a lock on those pages. New writes can happen concurrently, turning a just-flushed page dirty again. The checkpoint becomes 'fuzzy' because it doesn't capture a consistent snapshot of the buffer pool at a single point in time. The WAL ensures consistency: the checkpoint record is written after all prior dirty pages are flushed, but before the next transaction commits. Recovery uses that record to know where to start replay. The performance trade-off is worth it: writes never stall. But you pay in complexity—the checkpointer must coordinate with the WAL writer to ensure no dirty page is written before its WAL record hits disk. I've seen teams disable background writes thinking they'd speed things up. Don't. Let the fuzzy checkpoint do its job, and tune the number of buffers it writes per cycle (checkpoint_completion_target) to spread I/O load smoothly.
A fuzzy checkpoint that lasts longer than the checkpoint interval creates a cascade—the next checkpoint starts before the last one finishes. Monitor checkpoint_write_time and ensure it's consistently less than checkpoint_timeout.
🎯 Key Takeaway
Fuzzy checkpoints avoid write stalls by allowing concurrent modifications. They work because WAL guarantees recovery consistency, not because the flush is atomic.
● Production incidentPOST-MORTEMseverity: high
PostgreSQL Checkpoint Storm Wiped Out Production DB Performance
Symptom
Every hour, disk utilization spiked to 100%, query latency jumped from 5ms to 5s, and the database was unresponsive for several minutes.
Assumption
The team thought the disk was failing. They replaced SSDs twice before tracing it back to checkpoints.
Root cause
checkpoint_timeout was set to 60 seconds, forcing a full checkpoint every minute. Each checkpoint flushed hundreds of dirty buffers at once, saturating the I/O subsystem.
Fix
Increased checkpoint_timeout to 300 seconds and set checkpoint_completion_target to 0.9 to spread writes evenly over the interval. Also enabled full_page_writes only on replicas to reduce write amplification.
Key lesson
Monitor checkpoint-related metrics in pg_stat_bgwriter (buffers_checkpoint, checkpoint_sync_time).
Never use default checkpoint_timeout in production without baseline I/O capacity testing.
Fuzzy checkpoints are a lifesaver – they smooth out I/O load but require careful tuning of checkpoint_completion_target.
Production debug guideSymptom → Action mapping for checkpoint problems5 entries
Symptom · 01
Crash recovery takes >10 minutes
→
Fix
Check pg_stat_bgwriter: if checkpoints_timed > checkpoints_req, recovery will be long. Increase checkpoint_segments or checkpoint_timeout.
Symptom · 02
High I/O during checkpoint bursts
→
Fix
Query pg_stat_bgwriter: compare buffers_backend vs buffers_checkpoint. If buffers_backend is high, checkpoint interval is too long causing backend writes. Reduce checkpoint_timeout.
Symptom · 03
WAL segment accumulation (pg_xlog filling disk)
→
Fix
Check if archive_command is stalled or slow. If checkpoints are too infrequent, WAL keeps accumulating. Use pg_current_wal_lsn to track lag.
Symptom · 04
Checkpoint not completing before next one starts
→
Fix
Inspect checkpoint_write_time and checkpoint_sync_time in pg_stat_bgwriter. If total > checkpoint_timeout * checkpoint_completion_target, increase checkpoint_timeout or improve disk throughput.
Symptom · 05
Backend writes (buffers_backend) spike during checkpoint
→
Fix
Increase checkpoint_completion_target (e.g., 0.9) to spread writes. Also raise wal_buffers to reduce contention.
★ Checkpoint Quick Debug Cheat SheetImmediate actions and commands to diagnose checkpoint issues in PostgreSQL
Database recovery is slow after crash−
Immediate action
Check last checkpoint location and identify how much WAL needs to be replayed.
Base checkpoint_timeout on I/O benchmarks. Start with 10 minutes for heavy write workloads. Monitor buffers_backend ratio.
×
Setting checkpoint_completion_target too high (>0.95)
Symptom
Checkpoint times out, causing forced sync of all remaining pages — I/O storm exactly when you least want it.
Fix
Keep checkpoint_completion_target between 0.7 and 0.9. Leave headroom for OS write-back delays.
×
Disabling full_page_writes to save WAL space
Symptom
After a crash, pages are partially written and cannot be recovered — data corruption.
Fix
Keep full_page_writes on primary. On replicas, enable data checksums and test before disabling.
×
Forgetting to monitor pg_stat_bgwriter
Symptom
Unexplained performance degradation over time; checkpoint warnings in logs are ignored.
Fix
Set up monitoring for buffers_checkpoint, buffers_backend, checkpoint_write_time. Alert when backend_write_ratio > 20%.
×
Checking only total time, not the distribution
Symptom
Checkpoint appears fast, but recovery time grows because WAL accumulates.
Fix
Monitor max_wal_size usage and checkpoints_req vs checkpoints_timed ratio. Adjust accordingly.
INTERVIEW PREP · PRACTICE MODE
Interview Questions on This Topic
Q01JUNIOR
What is the purpose of a checkpoint in a DBMS?
Q02SENIOR
Explain the difference between sharp and fuzzy checkpoints. Which one do...
Q03SENIOR
How does checkpoint interact with WAL? What happens to WAL after a check...
Q04SENIOR
What configuration parameters would you tune in PostgreSQL to reduce I/O...
Q05SENIOR
What is full_page_writes and why is it important for checkpoint?
Q01 of 05JUNIOR
What is the purpose of a checkpoint in a DBMS?
ANSWER
A checkpoint synchronizes the database's in-memory dirty pages with the data files on disk. It records a special marker in the write-ahead log (WAL) indicating that all changes up to that point are safely stored. During crash recovery, the database only needs to replay WAL entries after the last checkpoint, drastically reducing recovery time. Without checkpoints, recovery would require replaying the entire transaction history from the beginning of the database.
Q02 of 05SENIOR
Explain the difference between sharp and fuzzy checkpoints. Which one does PostgreSQL use?
ANSWER
Sharp checkpoints flush all dirty pages at once—they are simple but cause a sudden I/O spike. Fuzzy checkpoints spread the flushing over a time window, smoothing I/O load. PostgreSQL uses fuzzy checkpoints controlled by checkpoint_timeout and checkpoint_completion_target. The checkpointer process writes dirty pages gradually throughout the interval, and the actual checkpoint record in WAL is written after all pages are flushed. Fuzzy checkpoints allow better performance in high-write environments.
Q03 of 05SENIOR
How does checkpoint interact with WAL? What happens to WAL after a checkpoint?
ANSWER
The checkpoint writes a record to the WAL containing the LSN up to which all data changes have been applied. After the checkpoint is complete, the database can recycle or archive WAL segments that are older than that LSN. During recovery, the system reads the last checkpoint from WAL and replays all subsequent records. If the checkpoint record is lost (e.g., due to a crash during checkpoint write), recovery falls back to the previous checkpoint. This is why checkpoint writes are synchronous and include a WAL flush.
Q04 of 05SENIOR
What configuration parameters would you tune in PostgreSQL to reduce I/O spikes from checkpoints?
ANSWER
Increase checkpoint_timeout (e.g., to 10 minutes) to reduce checkpoint frequency. Increase checkpoint_completion_target to 0.9 to spread the writes evenly. You may also need to increase max_wal_size to accommodate longer intervals. For very write-heavy workloads, consider increasing the checkpointer process's priority or using dedicated I/O bandwidth. Monitor pg_stat_bgwriter to see the ratio of buffers_checkpoint to buffers_backend; if backend writes are high, the checkpointer is overwhelmed and you need to tune further.
Q05 of 05SENIOR
What is full_page_writes and why is it important for checkpoint?
ANSWER
full_page_writes ensures that the first modification to a page after a checkpoint writes the entire page image to the WAL. This protects against partially written data pages during a crash, which could corrupt the page. Without full_page_writes, a crash during recovery could result in an unrecoverable page. On a primary server, it must remain enabled. On replicas with data checksums, it can potentially be disabled for performance, but only if you have verified your storage is safe against torn pages.
01
What is the purpose of a checkpoint in a DBMS?
JUNIOR
02
Explain the difference between sharp and fuzzy checkpoints. Which one does PostgreSQL use?
SENIOR
03
How does checkpoint interact with WAL? What happens to WAL after a checkpoint?
SENIOR
04
What configuration parameters would you tune in PostgreSQL to reduce I/O spikes from checkpoints?
SENIOR
05
What is full_page_writes and why is it important for checkpoint?
SENIOR
FAQ · 5 QUESTIONS
Frequently Asked Questions
01
What is a checkpoint in DBMS in simple terms?
A checkpoint is a save point for your database. Every so often, the database takes all the changes it has in memory and writes them to disk, then marks in its log 'everything up to here is safe'. If the database crashes, it only has to replay changes made after that marker, so recovery is fast.
Was this helpful?
02
Why do checkpoints cause I/O spikes?
Because writing dirty pages to disk is I/O intensive. Sharp checkpoints do all the writes at once, causing a spike. Fuzzy checkpoints spread the writes over time to avoid spikes, but they still create steady I/O load.
Was this helpful?
03
How can I see when my last checkpoint occurred?
In PostgreSQL, query SELECT * FROM pg_stat_bgwriter; to see checkpoints_timed/req and the total buffers written. Also SELECT pg_last_checkpoint_timestamp(); gives the exact time of the last completed checkpoint.
Was this helpful?
04
What happens if a checkpoint fails?
The database will retry on the next scheduled checkpoint or when the WAL reaches max_wal_size. In extreme cases, transactions may stall if no WAL segment can be reused. The fix is to investigate I/O or archiving issues.
Was this helpful?
05
Do NoSQL databases use checkpoints?
Yes, many NoSQL databases use a similar concept. For example, MongoDB uses checkpoints to ensure journal files can be truncated, and Cassandra uses commit log and memtable flushes as analogous mechanisms.