#postgresql
Articles
How to Use PostgreSQL for Data Normalization
↗ ExternalData normalization in PostgreSQL, written with Timescale. Normal forms, when to denormalize instead, and how TimescaleDB changes the tradeoffs.
Recursive Query in SQL: What It Is, and How to Write One
↗ ExternalAs developers, querying in PostgreSQL for hierarchical data is difficult. SQL is a declarative programming language, but our brains are trained to think imperatively. Recursive queries using Common Ta…
Understanding SQL Aggregate Functions
↗ ExternalYou may have heard that 'data is the new oil.' By itself, data is unrefined and not valuable, but given processing and refinement, it becomes precious. We gain insights into our products, applications…
Understanding Foreign Keys in PostgreSQL
↗ ExternalForeign keys in PostgreSQL are a fundamental way of defining relationships between tables. Splitting data across multiple tables is foundational to relational databases and data normalization. However…
Explaining PostgreSQL EXPLAIN
↗ ExternalHow to read PostgreSQL EXPLAIN output: the plan, operations, row counts, and timing, and using it to figure out why a query is slow.
PostgreSQL Security Guide
↗ ExternalA PostgreSQL security guide written with Timescale. What to lock down, why it matters, and the ways attackers get in when you don't.
How to Use a Common Table Expression (CTE) in SQL
↗ ExternalCommon Table Expressions (CTEs) are my go-to tool when writing complex SQL queries. They can be thought of as working like sub-queries or temporary tables but with their own superpowers.
Understanding PostgreSQL Tablespaces
↗ ExternalTablespaces are a PostgreSQL feature that gets easily overlooked but can provide substantial speed improvements and cost-saving potential. As our database grows, tablespaces become a powerful tool in…
How to Design Your PostgreSQL Database: Two Schema Examples
↗ ExternalHow we design and lay out our tables is one of the most important decisions in developing effective and efficient PostgreSQL databases. A database schema is the architecture or structure of the data i…
Creating a Fast Time-Series Graph With Postgres Materialized Views
↗ ExternalFast time-series graphs in PostgreSQL, written with Timescale. Using materialized views and continuous aggregates for real-time analytics.
Easily Generate Mock Data with PostgreSQL
Using PostgreSQL's generate_series function to spin up mock data: integer sequences, date ranges, and time-series data for testing and demos.
Wrangling Table Bloat in Large PostgreSQL Tables
↗ ExternalTackling table bloat on large PostgreSQL tables, written with Timescale. Spotting bloat, tuning VACUUM and AutoVacuum, and partitioning with chunks.
How to Reduce Your PostgreSQL Database Size
↗ ExternalShrinking a PostgreSQL database, written with Timescale. Pages and tuples, how bloat accumulates, routine vacuums, compression, and retention policies.
Postgres: The Graph Database You Didn't Know You Had
You don't need Neo4j for graph data. Walking through nodes, edges, and recursive traversals in plain Postgres, with working SQL.