liveBook · Manning

What you will learn in Just Use Postgres!

All the database you need

by Denis Magda
Foreword by Josh Long
Afterword by Vlad Mihalcea

Chapter by chapter

Chapter 1: Meeting Postgres

1.1 Why is Postgres so popular? · 1.2 “Just use Postgres!” explained · 1.3 Starting Postgres in Docker · 1.4 Connecting with psql · 1.5 Generating mock data · 1.6 Running basic queries · 1.7 Summary

What you learn in chapter 1 →

Chapter 2: Standard RDBMS capabilities

2.1 Creating the database structure · 2.1.1 Creating databases · 2.1.2 Creating schemas · 2.1.3 Creating tables · 2.2 Querying and manipulating data · 2.3 Data integrity · 2.3.1 Constraints · 2.3.2 Foreign keys · 2.4 Transactions · 2.4.1 Implicit transactions · 2.4.2 Explicit transactions · 2.4.3 Multiversion concurrence control · 2.5 Joins · 2.6 Functions and triggers · 2.6.1 Functions: A practical example · 2.6.2 Triggers: A practical example · 2.7 Views · 2.8 Roles and access control · 2.9 Summary

What you learn in chapter 2 →

Chapter 3: Modern SQL

3.1 What is modern SQL? · 3.2 Loading the music service dataset · 3.3 Common table expressions · 3.3.1 Selecting data with CTEs · 3.3.2 Using multiple CTEs in a query · 3.3.3 Modifying data with CTEs · 3.4 Recursive queries · 3.4.1 Querying hierarchical data · 3.4.2 Using arguments in recursion · 3.5 Window functions · 3.6 Summary

What you learn in chapter 3 →

Chapter 4: Indexes

4.1 Why are indexes so popular? · 4.2 Overview of Postgres index types · 4.3 Loading the multiplayer game dataset · 4.4 Learning to use the EXPLAIN statement · 4.5 Single-column indexes · 4.5.1 Single-column B-tree indexes · 4.5.2 Single-column hash indexes · 4.6 Composite indexes · 4.6.1 Considering an additional single-column index · 4.6.2 Creating a composite index · 4.6.3 Caveats of composite indexes · 4.7 Covering indexes · 4.8 Partial indexes · 4.9 Functional and expression indexes · 4.10 Summary

What you learn in chapter 4 →

Chapter 5: Postgres and JSON

5.1 Storing JSON data · 5.2 Loading the pizza order dataset · 5.3 JSON in Postgres: Striking the balance · 5.4 Querying JSON data · 5.4.1 Extracting fields with the -> and ->> operators · 5.4.2 Using the ? operator to check for the presence of a key · 5.4.3 Comparing objects with the @> operator · 5.4.4 Using JSON path expressions · 5.5 Modifying JSON data · 5.6 Indexing JSON data · 5.6.1 Using an expression index with a B-tree · 5.6.2 Using GIN indexes · 5.7 Summary

What you learn in chapter 5 →

Chapter 6: Postgres for full-text search

6.1 Basics of full-text search in Postgres · 6.1.1 Tokenization and normalization · 6.1.2 Full-text search configurations · 6.2 Preparing data for text search · 6.2.1 Generating lexemes with the to_tsvector function · 6.2.2 Storing tsvector lexemes in the database · 6.3 Performing full-text search · 6.3.1 Using plainto_tsquery for simple queries · 6.3.2 Using to_tsquery for advanced filtering · 6.4 Ranking search results · 6.5 Highlighting search results · 6.6 Indexing lexemes · 6.6.1 Using GIN indexes · 6.6.2 Using GiST indexes · 6.7 Summary

What you learn in chapter 6 →

Chapter 7: Postgres extensions

7.1 The roots of Postgres extensibility · 7.2 Getting started with extensions · 7.2.1 Exploring available extensions · 7.2.2 Installing and using extensions · 7.3 Essential extensions for developers · 7.4 Postgres-compatible solutions · 7.5 Summary

What you learn in chapter 7 →

Chapter 8: Postgres for generative AI

8.1 How to use Postgres with gen AI · 8.1.1 Postgres and LLMs · 8.1.2 Postgres and embedding models · 8.2 Starting Postgres with pgvector · 8.3 Generating embeddings · 8.3.1 Generating embeddings for movies · 8.3.2 Loading the final dataset into Postgres · 8.4 Performing vector similarity search · 8.4.1 Using cosine distance for similarity search · 8.4.2 Changing the search phrase for better results · 8.5 Indexing embeddings · 8.5.1 Using IVFFlat indexes · 8.5.2 Using the HNSW index · 8.6 Implementing RAG · 8.6.1 Preparing the environment for the prototype · 8.6.2 Interacting with the LLM · 8.6.3 Retrieving context for LLM · 8.6.4 Using RAG to answer questions · 8.7 Summary

What you learn in chapter 8 →

Chapter 9: Postgres for time series

9.1 How Postgres works with time-series data · 9.2 Starting Postgres with TimescaleDB · 9.3 Loading the time-series data · 9.4 Exploring TimescaleDB hypertables · 9.5 Analyzing time-series data · 9.5.1 Using the time_bucket function · 9.5.2 Using the time_bucket_gapfill function · 9.6 Using continuous aggregates · 9.6.1 Creating and using aggregates · 9.6.2 Refreshing aggregates · 9.7 Indexing time-series data · 9.7.1 Using a B-tree index · 9.7.2 Using BRIN indexes · 9.8 Summary

What you learn in chapter 9 →

Chapter 10: Postgres for geospatial data

10.1 How Postgres works with geodata · 10.1.1 Built-in Postgres capabilities · 10.1.2 Extended capabilities with PostGIS · 10.2 Starting Postgres with PostGIS · 10.3 Loading the OpenStreetMap dataset · 10.3.1 Exploring tables with points · 10.3.2 Exploring tables with ways · 10.3.3 Exploring table with polygons · 10.4 Visualizing geospatial data · 10.5 Querying geospatial data · 10.5.1 Working with points · 10.5.2 Working with polygons · 10.5.3 Working with line segments · 10.6 Indexing geospatial data · 10.6.1 Understanding GiST structure · 10.6.2 Using a GiST index · 10.7 Summary

What you learn in chapter 10 →

Chapter 11: Postgres as a message queue

11.1 When to use Postgres as a message queue · 11.2 Building a custom message queue · 11.3 Using a custom queue · 11.4 Using LISTEN and NOTIFY · 11.5 Queue implementation considerations · 11.5.1 LISTEN and NOTIFY considerations · 11.5.2 Indexing considerations · 11.5.3 Partitioning considerations · 11.5.4 Messages processing failover considerations · 11.6 Starting Postgres with pgmq · 11.7 Using pgmq · 11.7.1 Creating and using a visitors queue · 11.7.2 Using message visibility timeouts · 11.8 Summary

What you learn in chapter 11 →

Concepts explained in this book

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.