Month: April 2019
Triggers to enforce constraints in PostgreSQL
Sometimes you want to enforce a condition on a table that cannot be implemented by a constraint. In such a case it is tempting to use triggers instead. This article describes how to do this and what to watch out for. It will also familiarize you with the little-known PostgreSQL feature of “constraint triggers”. […]
DECLARE CURSOR in PostgreSQL or how to reduce memory consumption
Have you ever heard about cursors in PostgreSQL or in SQL in general? If not you should definitely read this article in depth and learn how to reduce memory consumption in PostgreSQL easily. Cursors have been around for many years and are in my judgement one of the most underappreciated feature of all times. Therefore, […]
Security and PostgreSQL – a reminder on various attack surfaces
Needless to say, security is a topic that nobody in the wider IT industry can ignore nowadays, with a constant flow of reports on data breaches of various scales. Most of such cases don’t result from direct attacks against databases though, but more from targeting Application / API / Webserver problems as database servers are […]
PostgreSQL count(*) made fast
It is a frequent complaint that count(*) is so slow on PostgreSQL. In this article I want to explore the options you have to get your result as fast as possible. Added bonus: I’ll show you how to estimate query result counts. Why is count(*) so slow? Most people have no trouble understanding that […]