PostgreSQL: Simple C Extension Development for a Novice User (and Performance Advantages)

One of the great features of PostgreSQL is its extendability. My colleague and senior PostgreSQL developer Ibar has blogged about developing an extension with much broader capabilities including callback functionality. In this blog post, I am trying to address a complete novice user who has never tried but wants to develop a simple function with business logic. Towards the end of the blog post, I want to show how lightweight the function is by doing simple benchmarking, which is repeatable and should act as a strong justification for why end-users should do this kind of development.

Generally, PostgreSQL and extension developers work on a PostgreSQL source build. For a novice user, that may not be required. Instead, dev/devel packages provided for the Linux distro would be sufficient. Assuming that you have installed PostgreSQL already, the following steps can get you the additional development libraries required.