This site is about a previous instance of this event. For the current event, please see the updated site.

Schedule - PGConf.EU 2015

An Introduction to PostgreSQL Triggers

Date: 2015-10-29
Time: 12:50–13:40
Room: Palais I-III
Level: Beginner

Triggers are those little bits of code running in your database that gets executed when something happens that you care about. Whether you are a developer who puts all of your business logic inside of PL/pgSQL functions or someone who uses an ORM and wants to stay away from database code, you will likely end up using triggers at some point. The fact that the most recommend way of implementing table partitioning in PostgreSQL uses triggers accounts for the importance of understanding triggers.

In this talk, we will step through examples of writing various types of triggers using practical uses cases like partitioning and auditing.

  • The structure of a trigger
  • BEFORE vs AFTER triggers
  • Statement Level vs Row Level triggers
  • Conditional triggers
  • Event triggers
  • Debugging triggers
  • Performance overhead of triggers

All of the examples will be done using PL/pgSQL so in addition to getting an overview of triggers, you will also get a good understanding of how to code in PL/pgSQL. There will be examples from conditionals to loops and cursors.

Speaker

Jim Mlodgenski