Skip to content

Commit

Permalink
TIL
Browse files Browse the repository at this point in the history
  • Loading branch information
dingxiong committed Dec 6, 2024
1 parent 7ef97bb commit 76cd368
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
6 changes: 6 additions & 0 deletions _posts/2023-12-10-tech-diary.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ tags: [diary]

Some random thoughts or learnings.

## 2024-12-05 Thu

I always came cross real models. For example today
<https://2023.splashcon.org/details/iwaco-2023-papers/5/Borrow-checking-Hylo>.
Stay focused and consistently!

## 2024-10-06 Sun

I came across this repo <https://github.com/libusual/libusual> when I dig into
Expand Down
20 changes: 16 additions & 4 deletions _posts/2024-12-04-postgres-vacuum.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ The purpose of vacuum:
3. Prevent transaction id wraparound failure

- how to find the max and min XID in postgres
- how is vacuum affected by XID?
- how dd dashboard show low row count after failover
- how does it set FrozenTransactionId
- how MVCC prevents vacuum, and only subset of tables or all tables?
Expand All @@ -22,9 +21,7 @@ How does vacuum compare XID? See
[code](https://github.com/postgres/postgres/blob/a3e6c6f929912f928fa405909d17bcbf0c1b03ee/src/backend/access/transam/transam.c#L280)
Wrapp around happens

## Autovacuum

### When will autovacuum run?
## When will autovacuum run?

Autovacuum is controlled by two parameters

Expand Down Expand Up @@ -97,6 +94,21 @@ VACUUM

You see that it skips 1 page due to buffer pins.

## Freezing

[MVCC in PostgreSQL — 8. Freezing](https://postgrespro.com/blog/pgsql/5967948)
from postgrespro is the best article talking about freezing I can find online.
It creates a live experiment that I can follow. The important parameters that
control the freezing are below:

- vacuum_freeze_table_age: the age of the transaction for which vacuuming
ignores the visibility map and looks through all the table pages in order to
do freezing
- vacuum_freeze_min_age: the minimum age of the xmin transaction for which a
tuple can be frozen
- autovacuum_freeze_max_age: forced autovacuuming is launched if
pg_class.relfrozenxid is older than this.

### Logs

`log_autovacuum_min_duration` controls the threshold of long-running autovacuum
Expand Down

0 comments on commit 76cd368

Please sign in to comment.