Good point, usually exceptions are more costly but I am not sure about Postgres, it might be worth…

The idea is that the exception will occur rarely and based on your partitioning scheme. If you are partitioning on a monthly basis then the exception should only occur once a month. The rest of the time you don’t incur the overhead of a create table statement on every insert.

Of course it’s also trivially easy to create a cron job which creates the next N month worth of tables. PG really needs to have built in scheduler for these things.

Show your support

Clapping shows how much you appreciated tim’s story.