Crunchy Data joins Snowflake.  Read the announcement

  • Getting Started with Postgres Functions in PL/Python

    Kat Batuigas

    Python is one of many procedural languages ( PLs ) included in standard PostgreSQL distributions. In this post, we'll take a quick look at how to get started with using PL/Python to write Postgres functions . If you're new to user-defined functions in Postgres, the idea is the same as in general programming: they're blocks of code you've written that are basically saved for use later. Each function carries out a specific task whenever it's called. A powerful feature of Postgres, especially...

    Read More
  • 5 min read

    Building a recommendation engine inside Postgres with Python and Pandas

    Craig Kerstiens

    I'm a big fan of data in general. Data can tell you a lot about what users are doing and can help you gain all sorts of insights. One such aspect is in making recommendations based on past history or others that have made similar choices. In fact, years ago I wrote a small app to see if I could recommend wines based on how other ones were rated. It was a small app that I shared among just a handful of friends, some with similar taste, some with different taste. At first it was largely an academi...

    Read More
  • Iterators in PostgreSQL with Lateral Joins

    Steve Pousty

    There you are writing some SQL, having a great time. Uh oh, you need to iterate over each item in a result set and apply a function. You think, "Now I am going to have to write a stored procedure." Well today's post will give you an alternative by using lateral joins in Postgres . Lateral... See what I did there? You are probably familiar with normal database joins , which are usually used to match up a column in one table with a column in another table to bring the data from both tables toget...

    Read More
  • Avoiding the Pitfalls of BRIN Indexes in Postgres

    John Porvaznik

    Postgres has a number of different index types. You’ve got B-Tree, GIN, GiST, Sp-GiST, and BRIN. BRIN is a lightweight index that often goes misunderstood. When implemented correctly, it offers significant benefits such as space savings and speed. However, when implemented incorrectly, it loses some of its benefit, so it's important to look at some of the reasons a BRIN index might not be right for you. A BRIN is a Block Range Index . A block is Postgres’ base unit of storage and is by defaul...

    Read More
  • 4 min read

    PostGIS and the Geography Type

    Paul Ramsey

    PostGIS is a "geospatial database" and the "geo" in "geospatial" is an important qualifier: it means that all the coordinates in PostGIS point, lines, and polygons can be located somewhere on the earth. As we all know (except for a few of us ) the earth is not flat, it's round . It's almost a sphere, an "oblate spheroid", slightly wider than it is tall. Because it is (mostly) spherical, we don't use cartesian coordinates (x, y) to describe locations on the earth, we use spherical coordinates...

    Read More
  • Announcing pgBackRest for Azure -  Fast, Reliable Postgres Backups

    Craig Kerstiens

    Backups are a key staple of running any database. Way back in the day, a good friend and colleague wrote one of the most used Postgres backup tools called wal-e. Wal-e was initially written in just a few days, and rolled out to the fleet of databases we managed in the early days at Heroku. We got pretty lucky with rolling that out, because shortly after we had there was the great AWS Apocalypse of 2011. This was a full day outage of AWS with lingering effects for nearly a week... Reddit was dow...

    Read More
  • Extending Django's User Model with OneToOneField

    Kat Batuigas

    This post is the second in a two-part series on my experience with adding a user registration system to a simple demo app built in Django. In my first post , I talk about how Django's built-in authentication system can do some of the heavy lifting for your registration setup. In this post, I'll walk you through how we tied our data models and authentication together by extending Django's model. You may recall from the first post that there wasn't a pure out-of-the-box solution for user accoun...

    Read More
  • Building a User Registration Form with Django's Authentication System

    Kat Batuigas

    If you haven't already read my colleague Steve Pousty's blog post on handling composite primary keys in a simple web application using Django and PostgreSQL, be sure to check it out. This post is going to be the first in a two-part series about adding a user registration system to the same app. In this first post, I'm going to talk specifically about setting up a "self-registration" form for our Dungeon and Dragons ( DnD ) players, using Django's built-in authentication (which includes built...

    Read More
  • 6 min read

    How to SCRAM in Postgres with pgBouncer

    Jonathan S. Katz

    I've made it no secret that I am a huge fan of PostgreSQL 's SCRAM support: it provides a secure, standardized way of performing authentication with passwords, and is a method that can be universally applied. The beauty of SCRAM is that both authenticating parties (in this case, your client/application and PostgreSQL) can both verify that each party knows a secret without ever exchanging the secret . In this case, the secret is a PostgreSQL password! That is incredible , and is also a hug...

    Read More
  • 13 min read

    Getting Started with PostgreSQL Operator 4.3 in OpenShift

    James Chanco Jr.

    The first step of working with any software is getting it installed. Based on your environment, this could be as easy as a one-click installer, or require a manual that's hundreds of pages long with thousands of config bits to tune. Deploying complex applications on Kubernetes and OpenShift can often fall somewhere in the middle. For example, deploying an Operator on OpenShift can be viewed as an intimidating thing, but it doesn't have to be. Here we're going to walk through the quickest and e...

    Read More