de en es fr nl pl pt sv zh

other

July 2026 Update on US-China Relationship

Don

With Trump in his second term as the President of the U.S., he has taken many actions that may be questionable from a legal perspective. Even if they are legal, they are definitely not for the benefits of the whole country, but only for the Republican Party and often for the benefits of Trump and...

PostgreSQL HeapTable + Pin vs MySQL InnoDB IOT + Persist cursor

baotiao

前面介绍过 PostgreSQL Buffer Access 5 Rules 里面的 Pin 机制, 其实 HeapTable + Pin 机制还带来了其他和 InnoDB 的区别. InnoDB Persist cursor 是用来保留查询遍历 btree 过程中 index tree cursor 的位置. 为什么需要 persist cursor? 因为有多种场景下, 比如在执行大查询时, 查到一行以后, 需要将数据返回给 server 层处理. 这时, 你不能在返回指向 Record 的指针 index tree cursor 后依然持有该 Page 的锁 (Latch)....

PostgreSQL Buffer Access 5 Rules

baotiao

src/backend/storage/buffer/README 是 PG 社区维护 buffer manager 的官方设计文档. 它在开头列了 5 条 buffer access rules, 提 patch / review 时直接引用. 这 5 条规则合起来定义了 PG 的 Pin 协议, 也是 PG 和 InnoDB buffer manager 设计上真正分叉的地方. 同步原语先看清楚 PG 的 buffer 上有两个独立的同步原语: Pin — atomic refcount, 防止 slot 被 evict 换成别的 page. 持有时间可长可短, 甚至跨函数...

Your CrossFit App Doesn’t Know What You Did

Perfection Kills

Your CrossFit App Doesn't Know What You Did CrossFit apps are good at storing WOD scores, but are terrible at knowing the work you've actually done. Here's a WOD from my box: Out of 20 results, only 1 person did it RX: Stored, not understood In SugarWOD the only way to mark WOD as scaled...

MySQL/PostgreSQL Slot-based Buffer Manager Pin/buf_block_fix operator

baotiao

在 MySQL/PostgreSQL Buffer Pool 里面有一个 Pin 操作 — PostgreSQL 叫 Pin, MySQL InnoDB 叫 buf_block_fix / io_fix. 这些操作本质上都是把一个 page “pin” buffer pool 的某个位置上. 为什么在其他系统里很少见到这种代码? 答案是 PG 和 InnoDB 的 buffer pool 都用了同一种架构 — Slot-based Buffer Manager. 这种架构直接决定了 Pin 这个操作必须存在. Slot-based Buffer Manager 结构 启动时,...

CrossFit training in the age of AI

Perfection Kills

CrossFit training in the age of AI If you've been following this blog, you know I've spent the past year building PRzilla — from AI-powered WOD benchmarks to My Fitness visualizations that replaced a decade of spreadsheets to a full workout tracker. If you're new here, the short version: I left...

C++ StringView 优化字符串比较

baotiao

DuckDB / Velox / Umbra 里面常见的字符串表示方式. 和传统的 SimpleStr (ptr, len) 相比, 都是 16 字节, 但是 layout 不同. SimpleStr: [ ptr (8B) ][ len (4B) ][ pad (4B) ] StringView: 短字符串 (len ≤ 12): [ len (4B) ][ inline_data (12B) ] 长字符串 (len > 12): [ len (4B) ][ prefix (4B) ][ ptr (8B) ] 两个优化点: 短字符串直接...

从 PostgreSQL fsync EIO 失败处理说起

baotiao

2018 年, PostgreSQL 社区发现了一个存在了 20 年的严重问题: 当 fsync() 失败时, PostgreSQL 的处理方式可能导致静默数据丢失. 这个被称为 “fsyncgate” 的事件, 不仅揭示了 PostgreSQL 自身的架构缺陷, 更暴露了 Linux 内核, 文件系统与数据库之间在 I/O 错误处理上的深层矛盾. 在云原生时代, 这个问题的影响被显著放大 – 因为云存储上 I/O 错误的发生频率远高于本地存储. 本文将完整梳理这一问题的发现, 讨论, 解决方案, 以及它在云原生环境下带来的新挑战. 问题的发现 Craig Ringer 的报告...

Overnight success

Perfection Kills

Overnight success Exhibit A "Omg, look at this beautiful design", Cat said. "Finally, someone made a beautiful period tracking app". I was looking at a stylish "28" logo and UI with a color palette that could easily win Apple's app of the year. It had not just tracking, but symptom logging,...

What’s my XENOM score?

Perfection Kills

What's my XENOM score? TLDR: xenom calculator is here The other day I came across XENOM — a newly-founded global CrossFit competition with a known and fixed set of workouts. Think CrossFit Games but standardized to a consistent two-day event similar to HYROX. You get a score on each of the 10...

用 Claude Code 在 PostgreSQL 实现 Double Write Buffer 遇到的一些问题

baotiao

最近一直在探索怎么用 Claude Code 来帮忙写数据库内核的代码. 一开始是直接让 Claude code 在 PostgreSQL 上实现一套 Double Write Buffer, 参考 InnoDB 的实现. 代码 Claude 确实写得挺快, 但过程中发现一个问题: 它不会做设计. Buffer I/O 和 Direct I/O 的差异 我让 Claude 参考 InnoDB 的 DWB 实现方式, 在 PG 里面搞一份. 它很快就写出来了, 但其实有一个根本性的问题它完全没有意识到: InnoDB 是 Direct I/O, PostgreSQL 是 Buffer...

Claude Code 改写 PostgreSQL 内核, Full Page Write vs Doublewrite Buffer, 性能差 3 倍

baotiao

2026 年了, AI 能改数据库内核代码么? 我用 Claude Code 把 PostgreSQL 的 Full Page Write 换成了 MySQL 的 Doublewrite Buffer, 跑出来性能差了 3 倍. 起因 FPW 和 DWB 到底哪个更合理, 这个问题我想了很久. 之前在 pgsql-hackers 的 mailing list 上发过一个帖子讨论这事, 但没讨论出什么结果. 到了 2026 年, 正好想试试 Claude Code 能不能改内核代码, 顺便通过实际代码对比一下两种方案. Show me the code – 于是就有了这次实践....

为什么我认为 MySQL 比 PostgreSQL 集成 DuckDB 更加的优雅?

baotiao

我们看到目前有 3 个主流 PostgreSQL 集成 DuckDB 的方案在运行 pg_duckdb,pg_mooncake, pg_lake. pg_duckdb 是官方提供的 DuckDB 插件, 只能提供存量行存表到 DuckDB 的迁移, 无法让增量的数据同步到 DuckDB 表中, 适用场景比较受限. databricks 收购的 pg_mooncake 可以支持存量和增量的数据同步, 通过额外的 pg_moonlink 进程以逻辑复制的方式把 PostgreSQL 的数据复制过来, 并且以 Iceberg 格式写入, 后续如果有复制查询, 需要走 postgresql...

Reflections on training, 2025 → ‘26

Perfection Kills

Reflections on training, 2025 → '26 Looking back A big shift last year has been towards skill learning and widening movement repertoire. Now that I'm 40, I can't quite recover as fast after going hard on WODs. I've also grown weary of constantly chasing higher strength numbers: squat, deadlift,...

当 MySQL 遇到 DuckDB

baotiao

MySQL的插件式存储引擎架构 MySQL的核心创新之一就是其插件式存储引擎架构(Pluggable Storage Engine Architecture),这种架构使得MySQL可以通过多种不同的存储引擎来扩展自己的能力,从而支持更多的业务场景。MySQL的插件式架构如下图所示: MySQL的插件式存储引擎架构可以划分为四个主要的部分: 运行层(Runtime Layer):负责MySQL运行相关的任务,比如通讯、访问控制、系统配置、监控等信息。 Binlog层(Binlog Layer): 负责Binlog的生成、复制和应用。 SQL层(SQL...

CrossFit tracking app but… you’re in control?

Perfection Kills

CrossFit tracking app but... you're in control? As I was working on PRzilla — an app to track WOD scores, fitness skills and standards, I quickly realized that I needed a way to log new sessions without constantly doing a clunky, manual SugarWOD / Strong app export/import. There was really no...

My Fitness: from spreadsheet to an app

Perfection Kills

My Fitness: from spreadsheet to an app My fitness journey—as is the case with many teenagers—began with bodybuilding. I wanted to look good. Soon after, I found StrongLifts 5x5 and got into powerlifting. It became all about numbers: getting bigger bench, bigger squat, bigger press. Yet, I’ve...

PRzilla: CrossFit AI companion

Perfection Kills

PRzilla: CrossFit AI companion Why When I left LinkedIn, I itched to build something in the space dear to my heart — fitness and CrossFit specifically. I also wanted a challenge of building a full-stack app, something I’ve never done before. The app would solve my pain points but I wanted to...

The science of Vipassana

Perfection Kills

The science of Vipassana The Buddhist Framework: From Sensation to Misery First, the Buddhist terms which come from the chain of Dependent Origination (Paṭiccasamuppāda): Vedanā (Sensation/Feeling-Tone): This is the raw, unprocessed, pre-cognitive feeling that arises from sensory contact....

Vipassana through the modern lens

Perfection Kills

Vipassana through the modern lens I first heard about Vipassana few years ago. Also known as "10 day silent meditation", it seemed like an extreme challenge for highly spiritual people detached from the regular joys (and miseries) of life. So… not for me. Recently, a close friend has gone...

DuckDB 的 MVCC 设计与 HyPer 模型

baotiao

简单介绍一下 DuckDB MVCC 参考的 HyPer-style 设计 DuckDB 的 MVCC 实现参考 Fast Serializable Multi-Version Concurrency Control for Main-Memory Database Systems 实现 本文简单介绍 DuckDB 中这一套 MVCC 机制的设计思路, 以及与 InnoDB, Oracle 等数据库在可见性判断与版本号分配上的不同. 在这个 MVCC 实现里面, 有三个变量: transactionID startTime-stamps...

Welcome back to Paradise!

GB

by Giovanni Battista Tomassini We are back at Monte Velho, in Portugal, where the Lima Mayer family breeds magnificent Lusitano horses, destined to shine in international dressage competitions, with the commitment to honoring the memory of its champion, Ecuador, who died a year ago. He’s a...

The many souls of a genius

GB

by Giovanni Battista Tomassini Bartabas, the great French equestrian artist, founder of Zingaro, reflects back over his life and career in a beautiful book, recently published in France. A book in which he tells the stories of the many horses that have accompanied him over the years. A sort of...

A very important discovery: the equestrian treatise of the Lord of Lugny

GB

by Giovanni Battista Tomassini In an absorbing and very interesting book, just published in France, Frédéric Magnin presents a hitherto unknown equestrian treatise of a French author of the late Renaissance. It is a fundamental work because it demonstrates the circulation of texts about...