Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Map of Amazing Postgres Extensions You Might No...

Map of Amazing Postgres Extensions You Might Not Know About | Claire Giordano | PASS Data Summit 2024

Slides from a conference presentation at PASS Data Summit 2024 in Seattle. Abstract: Postgres extensions are everywhere—and are found in lots of Postgres deployments. You might even say that PG extensions are the tools that make your Postgres toolbox complete.

But navigating the world of PG extensions can be a challenge. If you’re new to Postgres, you might be wondering “What is a Postgres extension?” If you’re familiar with Postgres, you might still wonder: “Where do I find all the extensions? Can I trust them? Which Postgres extensions will make my life better and save me time?”

In this updated version of a talk I first gave at PGConf NYC, I’ll walk you through the set of amazing Postgres extensions I’ve learned about in my ~8 years working in the world of Postgres: what they are, why care about them, and where to find them. You’ll learn about popular extensions like pg_stat_statements, “super extensions” such as PostGIS and Citus—as well as over 20 lesser-known (or favorite) extensions which are quite handy, too.

This talk includes a brief detour into the history of Postgres extensions, and a glimpse into the future of extensions (spoiler: will they be built with Rust?). By the end of this talk, you’ll have a “map” of the world of amazing Postgres extensions—plus a legend and compass for figuring out which extensions can help you and your application.

Claire Giordano

November 06, 2024
Tweet

More Decks by Claire Giordano

Other Decks in Technology

Transcript

  1. Head of Postgres open-source community initiatives at Microsoft linkedin.com/in/claireg @clairegiordano

    @[email protected] she/her Giordano Engineer Dev Manager PM Marketer Writer Open-source champion Community Lead Podcaster
  2. Quite a lot of Postgres work @ Microsoft Azure Database

    for PostgreSQL MANAGED DATABASE SERVICE fully-managed database service for Postgres NEW CAPABILITIES in FLEXIBLE SERVER “Flexible Server” aka.ms/blog-pg-at-microsoft OPEN SOURCE WORK PostgreSQL core Contribute to PG open source (and review patches on many other people's work!) Citus Open Source Citus open-source extension to Postgres gives you Postgres at any scale. (Think: distributed Postgres.) PG Ecosystem Postgres extension & tooling our PG team at Microsoft maintains or contributed to in last ~8 months PG Community Contribute to growth & knowledge of the PostgreSQL open-source developer & user communities. @clairegiordano
  3. 5 What is a Postgres extension?  Adds functionality to

    Postgres (hence: “extends” Postgres)  Not a fork  To use—install Postgres & the PG extension(s)  To enable (or disable), get familiar with CREATE EXTENSION ALTER EXTENSION DROP EXTENSION
  4. 6 Search for a good analogy for Postgres Extensions plug

    & play beloved modular building toy
  5. 7 Search for a good analogy for Postgres Extensions can

    you add on specialized tools to Swiss Army Knife? are extensions similar to Apps in an App Store?
  6. 8

  7. 9

  8. To understand what exists, needed “mental map” of different types

    of PG extensions In 1<>1 with Daniel Gustafsson, explored this 1st draft set of “categories” 1. Monitoring 2. Indexing 3. Data types 4. Geospatial 5. Statistical Analysis 6. Distributed Scale 7. Connectors 8. Storage Optimizations
  9. But then I started to wonder... What categories is everyone

    else using for Postgres extensions? @clairegiordano
  10. First place I looked for Categories: PGXN.org I found tags!

    Not categories. I could search! Not browse extensions.
  11. Like a dog with a tennis ball I spent wayyyyyy

    too much time trying to come up with “right” set of categories
  12. All models are wrong, but some are useful.” “ —

    George Box, statistician Dimitri Fontaine reminded me of this quote @clairegiordano
  13. Mind map of Categories of Postgres Extensions AI / Machine

    Learning Admin Migration @clairegiordano
  14. 25 Mind map of Postgres Extensions (by category) pg_cron pgtap

    amcheck pg_partman pgvector postgresml HLL topn postgres_fdw Citus multicorn postgis pgrouting hypopg RUM plv8 orafce pg_stat_statements pg_hint_plan pgSentinel fuzzystrmatch AI / Machine Learning Admin Migration tdigest pg_prewarm pg_surgery @clairegiordano azure_ai
  15. postgres_fdw CONTRIB fdw = “Foreign Data Wrapper” lots and lots

    of foreign data wrappers (just a few listed here) mysql_fdw mongo_fdw postgres_fdw duckdb_fdw tds_fdw oracle_fdw kafka_fdw Connectors CATEGORY mysql_fdw
  16. Citus Distributed PostgreSQL “Postgres at any scale” Sharding Led by

    Microsoft “Super extension” CATEGORY Distributed Scale
  17. azure_ai Not open source (yet!) Integrated with Azure OpenAI service

    Enables you to create text embeddings within your Azure Database for PostgreSQL database CATEGORY AI / Machine Learning Source: Pic by Tonie Huizer on LinkedIn of Microsoft PASS 2024 keynote
  18. pg_cron Created/maintained by Marco Slot CATEGORY Admin “pg_cron: probably the

    best way to schedule jobs within PostgreSQL database” —Prashant @ FatDBA.com - - vacuum my table every night at 3am (GMT) SELECT cron.schedule( '0 3 * * *’, 'VACUUM my_table’ ); - - call a procedure every minute SELECT cron.schedule('process-new-events’, '* * * * *', 'CALL process_new_events()');
  19. RUM more powerful version of GIN index for text search

    (or your own custom types) stores additional info per entry, e.g. timestamp CATEGORY Index
  20. CATEGORY Index hypopg hypothetical indexing try out an index for

    free: doesn’t cost CPU, disk, resources visible to query planner helps you find an index for slow queries
  21. pg_hint_plan “ —Rob Treat, statistician It’s an excellent learning tool,

    really good for deep dive performance work. Why? Because it gives you ability to pick and choose between different indexes—and get the execution plan without having to rebuild those indexes... The larger the data set the more valuable it is.” CATEGORY Performance
  22. pg_hint_plan “ —Rob Treat, statistician It’s an excellent learning tool,

    really good for deep dive performance work. Why? Because it gives you ability to pick and choose between different indexes—and get the execution plan without having to rebuild those indexes... The larger the data set the more valuable it is.” CATEGORY Performance EP10: “My Journey into Postgres Monitoring” TalkingPostgres.com LISTEN TO THE PODCAST
  23. pgsentinel a way to get what’s going on in the

    database over time you can look at “right now” with pg_stat_activity, but maybe something important happened 5 minutes ago? or maybe you need statistics about “what’s been happening in my database” created/maintained by Bertrand Drouvot CATEGORY Performance
  24. plv8 procedural language lets you run JavaScript code stored procedures,

    triggers plv8 documentation link from Jerry Sievert Language CATEGORY https://plv8.github.io/
  25. orafce makes it easier to migrate from Oracle to Postgres

    functions, data types... mysql_fdw Migration CATEGORY
  26. “ —Daniel Gustafsson, Postgres hacker at Microsoft The TAP in

    pgTAP stands for “test anything protocol.” pgTAP enables you to write unit tests for your database—for objects, tables, & views. Developers will tell you it’s really really cool.” pgTAP CATEGORY Admin
  27. pg_prewarm CONTRIB useful to put pages back in cache after

    restarting Postgres maybe should have been in “Performance” category? Admin CATEGORY
  28. fuzzystrmatch CONTRIB ”fuzzy string match” Source: pganalyze blog post: Similarity

    in Postgres and Rails using Trigrams Text CATEGORY pg_trgm CONTRIB “trigram”
  29. 60 4 common sources for Postgres extensions... +1 to Christoph

    Berg, Devrim Gündüz, David Wheeler, & all PG extension creators! RPM & Debian “Contrib” (pre-bundled) RPM, Debian, etc. package PGXN Client Cloud provider (if managed service)
  30. PGXN v2 improvement project community project led by David Wheeler

    from Tembo 61 Want to get involved or provide input? Future PGXN-v2 Architecture Diagram (Apr 2024) Source: David Wheeler of Tembo: https://gist.github.com/theory/1de9633f57976e778b46b013867c3147 pgtreats.info/slack-invite Join #extensions channel on Postgres Slack
  31. 63 Source: cs.cmu.edu. Copyright 1984 ACM. Originally published in Communications

    of the ACM, August 1984, Volume 27, Number 8. Copy by permission of the Association of Computing Machinery.
  32. PGRX = for building Rust extensions Created by Eric Ridge

    of ZomboDB... Used by 228 repos so far (last time I gave this talk it was 62 repos!) 3.7K stars
  33. Not only do developers love Rust—extensions that are built in

    Rust will benefit users too Source: Jelte Fennema talk “Postgres without SQL: Natural language queries using GPT-3 & Rust” at Citus Con: An Event for Postgres 2023. Published on YouTube.
  34. People to thank for inspiration & reviews Daniel Gustafsson David

    Wheeler Devrim Gündüz Dimitri Fontaine Jelte Fennema-Nio Jerry Sievert Marco Slot Melanie Plageman Nik Larin Robert Treat Samay Sharma Teresa Giacomini Thomas Munro
  35. Our Talking Postgres podcast about human side of PG Recent

    guests: David Rowley, Melanie Plageman, & Tom Lane…