Latest posts from Elizabeth Christensen

  • Window Functions for Data Analysis with Postgres

    Elizabeth Christensen

    SQL makes sense when it's working on a single row, or even when it's aggregating across multiple rows. But what happens when you want to compare between rows of something you've already calculated? Or make groups of data and query those? Enter window functions. Window functions tend to confuse people - but they’re a pretty awesome tool in SQL for data analytics. The best part is that you don’t need charts, fancy BI tools or AI to get some actionable and useful data for your stakeholders. Window...

    Read More
  • Query Hugging Face Datasets from Postgres

    Elizabeth Christensen

    If you missed the database news lately, you could have missed that we just fused DuckDB with Postgres to build a really fast analytics platform based on Postgres. There’s so many interesting things you can do with this platform so expect to hear from me again 😉. Today I just want to show off one really simple trick for getting big data sets or training data into Postgres through Hugging Face. Hugging Face is a community repository of datasets, LLMs, models and other resources for Machine L...

    Read More
  • 7 min read

    Magic Tricks for Postgres psql: Settings, Presets, Echo, and Saved Queries

    Elizabeth Christensen

    As I’ve been working with Postgres psql cli, I’ve picked up a few good habits from my Crunchy Data co-workers that make my terminal database environment easier to work with. I wanted to share a couple of my favorite things I’ve found that make getting around Postgres better. If you’re just getting started with psql, or haven’t ventured too far out of the defaults, this is the post for you. I’ll walk you through some of the friendliest psql settings and how to create your own preset settings file...

    Read More
  • Parallel Queries in Postgres

    Elizabeth Christensen

    Many folks are surprised to hear that Postgres has parallel queries out of the box. This was released in small batches across a half dozen versions of Postgres, so the major fanfare for having parallelism got a little bit lost. By default Postgres is configured for two parallel workers. The Postgres query planner will assemble a few plans for any given query and will estimate the additional overhead of performing parallel queries, and make a go or no-go decision. Depending on the settings and th...

    Read More
  • 3 min read

    Converting DMS to PostGIS Point Geometry

    Elizabeth Christensen

    I love taking random spatial data and turning it into maps. Any location data can be put into PostGIS in a matter of minutes. Often when I’m working with data that humans collected, like historic locations or things that have not yet traditionally been done with computational data, I’ll find traditional Degrees, Minutes, Seconds (DMS) data. To get this into PostGIS and QGIS, you’ll need to convert this data to a different system for decimal degrees. There’s probably proprietary tools that will d...

    Read More
  • 8 min read

    Contributing to Postgres 101: A Beginner's Experience

    Elizabeth Christensen

    I recently got my very first patch into PostgreSQL! To be clear I'm not a C developer and didn't contribute some fancy new feature. However, I do love Postgres and wanted to contribute. Here's my journey and what I learned along the way. I had an idea for a docs patch while I was talking to Stephen Frost about some research and writing I was doing about HOT updates and fill factor . A recent update to HOT updates meant HOT could be compatible with BRIN. And while the HOT readme was up to date,...

    Read More
  • Postgres Performance Boost: HOT Updates and Fill Factor

    Elizabeth Christensen

    There’s a pretty HOT performance trick in Postgres that doesn’t get a ton of attention. There’s a way for Postgres to only update the heap (the table), avoiding having to update all the indexes. That’s called a HOT update , HOT stands for heap only tuple. Understanding HOT updates and their interaction with page fill factor can be a really nice tool in the box for getting performance with existing infrastructure. I’m going to review HOT updates and how to encourage them in your Postgres updates...

    Read More
  • 6 min read

    Connecting QGIS to Postgres and PostGIS

    Elizabeth Christensen

    QGIS, the Quantum Geographic Information System, is an open-source graphical user interface for map making. QGIS works with a wide variety of file types and has robust support for integrating with Postgres and PostGIS. Today I just wanted to step through getting QGIS connected to a Postgres database and the basic operations that let you connect the two systems. Connecting QGIS to Postgres is very similar to any other GUI or application, you’ll need the database host, login, and password details....

    Read More
  • 9 min read

    JSON and SVG from PostGIS into Google Sheets

    Elizabeth Christensen

    At PostGIS Day 2023 , one of our speakers showed off a really cool demo for getting JSON and SVGs in and out of Postgres / PostGIS and into Google Sheets. Brian Timoney put together several open source projects in such a cool way that I just had to try it myself. If you want to see his demo video, it is on YouTube . With Brian’s blessing, I’m writing up some additional details with a few of the sample code bits for those of you that want to try this or something similar for your own projects....

    Read More
  • Postgres TOAST: The Greatest Thing Since Sliced Bread?

    Elizabeth Christensen

    If you’ve ever dug under the hood of Postgres a bit, you’ve probably heard about the page. This is the on-disk storage mechanism and it's limited to an 8kb size. But what happens when you have data bigger than that 8kb? TOAST is made. Postgres TOASTs data by splitting it up into smaller chunks. TOAST stands for The Oversized Attribute Storage Technique. TOAST happens automatically, you don’t set up anything, it just comes with Postgres out of the box. So why should you care? Well TOAST can impac...

    Read More