Introduction to Hacking PostgreSQL

Gavin Sherry and I have presented several versions of a tutorial introduction on how to modify the PostgreSQL source code. The original version was given at the PostgreSQL Anniversary Summit in June of 2006. Gavin has since given a revised version of the talk (at LCA 2007), as have I (at PgCon 2007).

All three versions of the talk follow a similar format: the first 90 minutes provid a general introduction to the backend, common coding conventions, and the procedure that is typically followed for submitting a new patch. The second 90 minutes walk the audience through an example patch.

Ottawa (PgCon 2007)

Australia (LCA 2007)

Gavin presented an updated version of this tutorial at the PostgreSQL mini-conf that preceded LCA 2007. The slides and handouts for that talk are available.

Toronto (Anniversary Summit, 2006)

Presentation Slides

An example patch that adds support for the WHEN clause to the CREATE TRIGGER statement

statement Handout of notable sections of code from the example patch; when the slides include statement like "see page n", they are referring to pages from this handout

Other Talks

I've given two other talks on PostgreSQL internals:

"Inside the PostgreSQL Query Optimizer" describes how the optimizer works (as of April 2005). It is slightly out of date with respect to a few details, but is still mostly accurate.

"Query Evaluation Techniques in PostgreSQL" discusses the algorithms for implementing scans, joins, and aggregation used in PostgreSQL (as of October 2007).

Tom Lane gave a great talk on "recent" improvements to the PostgreSQL query optimizer in 2003. Despite being slightly dated, it is still worth reading.

Changelog