PostGIS 3.0.0 Just Released

Summary

With a lot of enhancements, bug fixes, and several new features, the release of PostGIS 3.0.0 brings improved speed and performance to CARTO users

This post may describe functionality for an old version of CARTO. Find out about the latest and cloud-native version here.
PostGIS 3.0.0 Just Released

Most of our users are aware that under the hood CARTO runs on PostgreSQL and PostGIS. In fact when it comes to contributing to PostGIS we are the most active organization working on the project. So for CARTO and our clients the 3.0 release is a big milestone!

If you are a CARTO user you have actually been using PostGIS 3.0.0 features for a long time. We run a custom version of PostGIS that is ahead of the release cycle which ensures that our users always have the fastest service possible. Still it is a huge moment of celebration when all of this functionality goes into a public release.

3.0 has been a moderately large release in terms of the amount of changes with over 150 issues addressed and CARTO has worked on at least 74 of them.

This release comes with a lot of enhancements bug fixes and several new features. You can find the full release notes here but we wanted to highlight some of the key areas that we are most excited about.

Overall PostGIS speed improvements

Speed Increases in PostGIS come in two flavors — Speeding up the actual functions and ensuring that they can run in parallel on PostgreSQL.

PostgreSQL 12.0 has also enabled better parallelization of functions in extensions like PostGIS. Now with better adjustment on PostGIS in terms of function costs parallelization should trigger much more.

One function that has seen its performance increased by more than an order of magnitude is ST_AsMVTGeom which is the internal function CARTO uses to create vector tiles. Other improvements that also benefit us are speed ups in ST_Simplify or ST_RemoveRepeatedPoints which are used when rendering raster images or preprocessing geometries for further analysis.

As an example of this improved performance we released this functionality on July 1st on our platform. One of our customers had been experiencing really poor response times for vector tiles with processing times of 20-30 seconds. Although the tiles were getting cached the performance on fresh tiles was really poor. On that release day those request times dropped to 200-300 milliseconds! You can imagine how happy the user was!

Data Observatory Components

This was a pretty extreme case with some highly degraded polygons on the user side but overall if you look at the impact on our infrastructure you can see the reduction in CPU usage across our entire cluster of PostgreSQL servers. The results are pretty dramatic.

Data Observatory Components

Enhancements to PostGIS

One core enhancement that many users will appreciate actually comes from GEOS 3.8 the underlying library that PostGIS uses. In essence we can now expect fewer topological errors and fewer instances of the infamous "self-intersecting" error an improvement that lots of GIS users will love to hear.

There has also been a steady improvement in the project's continuous integration cycle with the addition of new bots and tasks to better test against PostGIS dependencies in more architectures and platforms. These changes are key to detect and address existing bugs and to avoid introducing new ones. Although internal this is very important to ensure performance and stability across multiple architectures.

And of course there are a TON of bug fixing and new functions like ST_TileEnvelope which allows you to create the geometry of a tile as simple as:

{% highlight sql %}SELECT ST_AsText(ST_TileEnvelope({zoom} {x} {y}));{% endhighlight %}

Which in CARTO we had available for a long time as CDB_XYZ_Extent but now is available to everybody.

Summarizing this wave of PostGIS development

PostGIS has a lot of users around the world and many projects depending on it. With these improvements PostGIS 3.0 represents a great step forward for all of those users and projects..

At CARTO we always run the latest and fastest PostGIS available optimized for the cloud but being part of a large Open Source community means we join efforts with many others. We would love to hear what you think about this release and new ideas for the future of PostGIS.

Want to chat with our spatial experts?

Get in touch with our team today!