
A unique constraint where NULL conflicts with everything
A cute solution for an unusual request for a unique constraint in PostgreSQL. This blog showcases range data types & exclusion constraints.
285 articles from CYBERTEC PostgreSQL.

A cute solution for an unusual request for a unique constraint in PostgreSQL. This blog showcases range data types & exclusion constraints.

This article compares pagination methods for PostgreSQL and their performance. Also, avoid displaying the total result count!

Find out how JSON logs can be configured in PostgreSQL 15 and get all the advantages of this brand new feature

NEW in PostgreSQL 16 - support for non-decimal notation of integer constants. Find out how the changes will affect you-- adds possibilities!

Find out the impact of PostgreSQL column data types on the performance of queries that involve a UNION ALL.

Learn how to implement faceting in your PostgreSQL-based applications to narrow search results - very attractive for users.

When partitioning in PostgreSQL, it's not obvious how to find the location of data afterwards. Here's some great partition tips and tricks.

EXPLAIN (ANALYZE, BUFFERS) output is hard to get for a parameterized statement in PostgreSQL. With a few tricks we can get EXPLAIN output.

Improve queries in PostgreSQL - it is not always possible to rewrite OR to UNION in a query. Find out when it is safe to do manually.

How do you index in a data warehouse? See the advantages and disadvantages of btree (AKA B-tree) and BRIN indexes in PostgreSQL.

How to upgrade current library versions such as GEOS or GDAL in PostGIS - use the latest stunning spatial features. Upgrade GEOS with Ubuntu.

Updates getting slower is a frequent complaint of PostgreSQL users. What is behind it and how can I avoid slow updates?

Connections are not free. Conserve your resources - find out about connection pooling in PostgreSQL with pgbouncer.

Did you ever wonder why VACUUM does not shrink PostgreSQL data files? Learn all the most useful secrets of VACUUM.

If 1000's of users constantly poll the database, a lot of load is caused for no benefit. LISTEN / NOTIFY is a better way, find out how.

What's the problem with using PostgreSQL database side sequences to create unique invoice numbers to send to clients? Let's find out.

Joins: Learn how to use an inner join and an outer join in PostgreSQL today by reading our tutorial. Also covers semi and full joins.

Aliases are mandatory for sub-SELECTS by SQL standard. Some vendors (Oracle) don't force that rule. Will PostgreSQL follow it in the future?

New syntax for SQL functions was introduced in PostgreSQL v14, this article gives you vital tips for this important change & its advantages.

gexec PostgreSQL poweruser practice: Learn how to use the gexec command and the `||` operator to get the best results out of your psql.

Column order can determine how quickly your data is processed in PostgreSQL. Find out how to troubleshoot performance problems in wide tables

Learn how to address the issue of bonus programs in SQL, improve your understanding of PostgreSQL, and calculate bonus points efficiently

This article shows how surprising transaction anomalies can happen with SELECT FOR UPDATE and what you can to to avoid them.

We discuss the options for case-insensitive comparison and pattern matching in PostgreSQL, comparing the performance of different approaches.

How view permissions are checked, and how that changes if you use the security_invoker view option from PostgreSQL v15. Use row-level security effectively.

This article describes how to cancel queries in PostgreSQL and shows a trick that you can use if canceling a query doesn't work.

Time zone management and timestamp data types in PostgreSQL - learn how to use 'timestamp with time zone' correctly and optimize performance.

Merge - UPDATED 2023 - a technical preview of how to merge lists with ease. Find out about a wonderful command - add power to your PostgreSQL.

Use MobilityDB to analyze historical air traffic data. A quick-start guide to dealing with spatio-temporal data together with PostGIS

Learn how to use DROP ROLE and DROP USER in PostgreSQL. This article explains how to remove users and gives troubleshooting tips.

How do query parameter data types affect performance? Find out how to avoid bad performance by choosing the correct parameter types.

This article shows how pipeline mode, new with PostgreSQL v14, can improve query performance over slow network connections.

Find out how to monitor PostgreSQL databases on Google Cloud with the pgwatch2 monitoring solution to get extended metrics for added clarity!

Data normalization - Learn how to apply the theory from part 1 of Michał Małecki's blog to real life with practical examples.

This article explains what the entity-attribute-value (EAV) model is and why you shouldn't use it in a relational database.

This article describes how cursors and transactions interact, how WITH HOLD can overcome the limitations, plus some caveats and tricks.

Importing OpenStreetMap data into PostGIS is time-consuming. Download OpenStreetMap offers two dataset types periodically served as sql dumps.

How you can end up with gaps in sequences & how they can even skip backwards. How to build a gapless sequence in PostgreSQL.

This article describes what can go wrong when using the much-loved JSON capabilities of PostgreSQL and gives guidelines how to do it right.

Oracle to PostgreSQL migration - Lessons learned in building a migration tool. How to avoid errors, null bytes and broken content.

This article describes how PostgreSQL v14 reduces B-tree index bloat with "bottom-up index tuple deletion". A test case shows the difference.

PostgreSQL vs Redis vs Memcached: How would it look on the performance side, if one just skips the cache & hits the database directly?

zheap has been designed as a new storage engine to handle UPDATE in PostgreSQL more efficiently. Read about the current status and more.

The LIMIT/OFFSET clause is off standard and thus not portable. Read about the proper way to handle it by using “SELECT … FETCH FIRST ROWS”.

How to simulate unsupported out of the box temporal tables in PostgreSQL using delayed streaming replication and dblink extension

Constraints over multiple rows: How to cope with complex PostgreSQL constraints. Advanced techniques - enforce integrity; manage concurrency.

A “materialized view” is an integral feature of every advanced database system. How can you make use of materialized views in PostgreSQL?

Did you know PostgreSQL has the ability to synchronize sequential scans? If you are running data warehouses, you might have already used it without knowing.

UPDATED July 2023: How to use EXPLAIN ANALYZE in PostgreSQL, learn tools to visualize the output. See query execution time and row count.

This article is about bulk loading, which is the quickest way to import large amounts of data into a PostgreSQL database.

UPDATED Mar 2023: How to use pg_stat_statements to detect slow queries - including examples and code - improve PostgreSQL performance

This tutorial will show you how to setup up and configure streaming replication for PostgreSQL 13 & how to set up database servers quickly.

Analysing data within PostGIS is just one side of the coin. This blogpost is about publishing datasets as maps using Geoserver and PostGIS.

TLS is a technology widely used in combination with PostgreSQL to encrypt client / server connections. This blogpost explains how TLS works.

"ERROR: deadlock detected" - message - what should I do? This article explains what this really means and how deadlocks can be prevented.

A new feature has arrived: "pg_read_all_data" - a predefined role that can run an unfettered pg_dump without that role being a superuser.

Basically, there are two ways to delete BLOBs (binary large objects):Change the PostgreSQL configuration or delete the BLOBs in chunks.

Visualizing spatial data is an important task. This tutorial helps you with getting started with visualizing OSM data with PostGIS and QGIS.

PostgreSQL allows you to define users (=roles), groups, etc. This post explains how to retrieve information on roles & role membership.

This article explains what PostgreSQL tablespaces are, when to use them and how they are different from Oracle tablespaces.