Skip to content

Most items $2 · Packs priced separately

pocketshelf

Blog and CMS SQL: Performance Queries

sql-performance-queries-for-blog-and-cms.pdfShowing 15 of 59 lines
// Read the query plan
EXPLAIN (ANALYZE, BUFFERS)
SELECT * FROM posts
WHERE author_id = 42 AND status = 'draft';

// Index the foreign key
CREATE INDEX CONCURRENTLY posts_author_id_idx
  ON posts (author_id);

// Composite index
CREATE INDEX CONCURRENTLY posts_author_id_published_at_idx
  ON posts (author_id, published_at DESC);

// Partial index
CREATE INDEX CONCURRENTLY posts_draft_idx

What's inside

  • Blog and CMS SQL: Performance Queries, preview page 1 with code examples in two columnsPage 1
  • Blog and CMS SQL: Performance Queries, preview page 2 with code examples in two columnsPage 2
Format
PDF, Markdown, SQL
Contents
12 queries
Version
1.0 · Updated 3 Oct 2026
Licence
Commercial What this means
Checked
Checked before it ships
Files in your download
  • sql-performance-queries-for-blog-and-cms.pdfPDF · 21 KB
  • sql-performance-queries-for-blog-and-cms.mdMarkdown · 2 KB
  • sql-performance-queries-for-blog-and-cms.sqlSQL · 2 KB
  • LICENSE.txtadded to every download

About this item

A compact, printable snippet pack for indexing and query performance snippets for a blog and CMS database (authors and posts). Each of the 12 entries has a one-line explanation and a small example you can paste into your editor. The PDF uses a two-column A4 layout designed to sit next to your keyboard, and the same content ships as Markdown so you can search it or drop it into your notes, plus a .sql file with every query. Every SQL example targets PostgreSQL 16.

  • SQL
  • Blog and CMS
  • PostgreSQL
  • Snippets
  • Performance

You might also grab