Finding missing foreign keys
By coincidence I stumbled upon a table where one of its columns didn’t have a foreign key. I found this strange, since our convention is to always add foreign keys when appropriate. But humans are...
View ArticlePgcronjob: Cron daemon to run user defined functions
I find myself quite often having to split a large write operation such as updating millions of rows in a heavily used table. This usually boils down to writing a small Perl script that runs a small...
View ArticlePgTerminator: Kill misbehaving db users if important processes are waiting
If you are a DBA and ever have had to manually call pg_terminate_backend() to kill some misbehaving backend process, then this tool might be of interest. Long running queries are not a problem, as long...
View Articlepg_catalog visualized
I couldn’t find any graph showing all the relations between all the pg_catalog tables, so just for fun I wrote a little script to parse the SGML and generate a graph using GraphViz. #!/usr/bin/perl use...
View ArticleUsing pg_badplan to CREATE STATISTICS is a good plan
Thanks to Thomas Vondra’s presentation CREATE STATISTICS – What is it for? at Nordic PGDay 2018, my Trustly colleague Claes Jakobsson came up with the idea for a new extension. The presentation...
View Article