postgres-fdw 标签归档

共 1 篇文章 · 返回首页

【PG 内核】扩展系统与 FDW:PG 的 hook 机制如何让扩展影响 Planner 决策

拆解 PostgreSQL 扩展系统的两种核心机制:全局 hook 机制全景(planner_hook、ExecutorStart_hook、ProcessUtility_hook 等覆盖七个子系统)和 FDW(Foreign Data Wrapper)的 FdwRoutine 回调接口。重点分析 postgres_fdw 的 pushdown 机制——哪些 WHERE/ORDER BY/LIMIT 能推到远端执行、哪些被留在本地——以及扩展如何通过 GetForeignRelSize→GetForeignPaths→GetForeignPlan 三个回调影响 planner 的代价估算和路径选择。