~/talk

Writing a Foreign Data Wrapper

Talkat PGCon 2023 · 2023-05-30..06-02· [databases, compilers-and-language-design]
slides:none on file

Explains how to implement a PostgreSQL foreign data wrapper written in C (with an optional multicorn Python wrapper), what required FDW callbacks are (get_rel_size, get_foreign_paths, begin_foreign_scan, iterate_foreign_scan, rescan, end_foreign_scan), and that the planner receives internal paths not raw SQL. Shows handling of Datum types, Postgres memory contexts, validator/import_schema hooks, and cost hints (startup can be ~10s for remote connections). Demonstrates a working FDW: an “infinite” random-float table that performs pretty fast.

AI-written summary · about

  1. 0:00Intro
  2. 0:11Let's talk foreign data wrappers!
  3. 1:03OK, fine, what's a foreign table?
  4. 2:38A Foreign Data Wrapper!
  5. 3:20What does an FDW do?
  6. 8:23Error Handling.
  7. 9:27Datum.
  8. 11:03Types.
  9. 14:15Execution Order
  10. 14:48GetForeignRelSize
  11. 19:08GetForeignPaths
  12. 20:23Estimating Costs.
  13. 25:19BeginForeignScan
  14. 26:58The Steps.
  15. 28:16Memory Management.
  16. 32:35ImportForeignSchema
  17. 34:51Options.
  18. 37:27Multicorn.
  19. 38:12Have fun!
  20. 39:11A last note of caution.
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.