Skip to content

Blog refresh: B-tree indexes with Prisma ORM (series part 2) for Prisma 7 + Prisma Postgres#8029

Merged
ankur-arch merged 4 commits into
mainfrom
blog/refresh-indexes-part-2
Jul 7, 2026
Merged

Blog refresh: B-tree indexes with Prisma ORM (series part 2) for Prisma 7 + Prisma Postgres#8029
ankur-arch merged 4 commits into
mainfrom
blog/refresh-indexes-part-2

Conversation

@vanrensbird

@vanrensbird vanrensbird commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Refreshes the second post of the query-performance series (44k impressions/90d, position 6.7, 46 months old) per the blog refresh program: slug kept, original author kept, honest updatedAt.

Content changes

  • Walkthrough rebuilt as self-contained: the MySQL/Docker companion repo (ruheni/prisma-indexes) is replaced with a local Prisma Postgres setup via npx prisma dev; only prerequisite is Node.js.
  • prisma.$use() middleware (removed in v7) replaced with a $extends query extension for timing; $on('query') event logging shown as the alternative.
  • Teaches the v7 configuration model: no url in the schema datasource, prisma.config.ts carries the connection, explicit dotenv loading.
  • B-tree theory sections preserved (citation surface).
  • GEO pass: verified 80x claim in title/meta/intro, how-to heading, FAQ accordions (server-rendered bodies confirmed in HTML), descriptive image alts.
  • Positioning pass: schema-as-code framing on @@index, local-to-production Prisma Postgres path, one Prisma Next pointer with Early Access stage discipline.

Verification

Every command and number executed live on Prisma 7.8.0 + PostgreSQL 17 (local Prisma Postgres):

  • 500k rows seeded; filtered query 66.5ms Seq Scan -> 0.814ms Bitmap Index Scan after @@index([firstName]) (~80x), full EXPLAIN ANALYZE output in the post from the real run.
  • Sorted composite index syntax @@index([firstName(sort: Desc), lastName]) verified via pg_indexes DDL.
  • Blog link linter passes with no findings on this post.

Known limitation surfaced during verification (also noted in PR #8027): prisma migrate dev fails with P1017 against the local prisma dev PGlite server on 7.8.0; the post uses db push for the local loop and references migrate for production workflows.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Updated the article with refreshed Prisma ORM and PostgreSQL guidance.
    • Revised the walkthrough, examples, and performance benchmarks to reflect current indexing and query measurement practices.
    • Added expanded coverage of composite indexes, index sort order, and updated FAQ/summary sections.

vanrensbird and others added 3 commits July 7, 2026 14:36
…Postgres

Full walkthrough rebuilt: MySQL/Docker companion repo replaced with a
self-contained local Prisma Postgres setup, removed $use middleware in
favor of a client extension, all commands and numbers verified live on
Prisma 7.8.0 + Postgres 17 (66.5ms seq scan -> 0.8ms bitmap index scan
over 500k rows).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
80x claim quantified in intro/meta, how-to heading matches query
phrasing, FAQ accordions added (server-rendered, verified in HTML),
descriptive alt on the index diagram, Prisma ORM product link.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Schema-as-code framing on @@index (one source of truth for teams
and agents), local-to-production Prisma Postgres path in summary,
restrained Prisma Next pointer with EA stage discipline.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vanrensbird vanrensbird requested a review from ankur-arch July 7, 2026 12:36
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blog Ready Ready Preview, Comment Jul 7, 2026 12:42pm
docs Ready Ready Preview, Comment Jul 7, 2026 12:42pm
eclipse Ready Ready Preview, Comment Jul 7, 2026 12:42pm
site Ready Ready Preview, Comment Jul 7, 2026 12:42pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c1bbbaf7-61e9-45b3-9a6b-c49433d32f19

📥 Commits

Reviewing files that changed from the base of the PR and between 044f348 and 08d1ef1.

📒 Files selected for processing (1)
  • apps/blog/content/blog/improving-query-performance-using-indexes-2-MyoiJNMFTsfq/index.mdx

Walkthrough

This PR rewrites a blog article on query performance and indexing, updating it to reflect Prisma ORM 7 workflows. Changes include new frontmatter metadata, a modernized Prisma Postgres setup using prisma.config.ts, seeding of 500,000 users, a Prisma Client extension-based measurement approach, index benchmarking with EXPLAIN ANALYZE, composite index coverage, and updated FAQ/conclusion sections.

Changes

Indexing article rewrite

Layer / File(s) Summary
Frontmatter and article introduction
apps/blog/content/blog/improving-query-performance-using-indexes-2-MyoiJNMFTsfq/index.mdx
Frontmatter title/meta fields and updatedAt were updated; the introduction, overview, and B-tree explanation (including when to use B-tree indexes for equality/range/LIKE predicates) were rewritten.
Prisma ORM 7 project setup
apps/blog/content/blog/improving-query-performance-using-indexes-2-MyoiJNMFTsfq/index.mdx
New prerequisites, prisma/schema.prisma User model, prisma.config.ts with defineConfig/dotenv, and instructions to start npx prisma dev and capture the connection string were added.
Seeding and query measurement
apps/blog/content/blog/improving-query-performance-using-indexes-2-MyoiJNMFTsfq/index.mdx
Seeding of 500,000 users via a PrismaPg-adapter seed script, db push/generate/seed commands, and a src/measure.ts script using a $extends/$allOperations timing hook with EXPLAIN ANALYZE were added.
Index application and composite index bonus
apps/blog/content/blog/improving-query-performance-using-indexes-2-MyoiJNMFTsfq/index.mdx
@@index([firstName]) was added with new benchmark/query plan comparisons, and a bonus section covers composite indexes (@@index([firstName, lastName])) and descending sort order.
FAQ and conclusion updates
apps/blog/content/blog/improving-query-performance-using-indexes-2-MyoiJNMFTsfq/index.mdx
FAQ answers and the conclusion were updated to align with the new Prisma ORM workflow, verification via EXPLAIN ANALYZE, and next-article link.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • prisma/web#8000: Companion blog rewrite modernizing Prisma ORM 7 setup (prisma.config.ts, PrismaPg adapter/seed workflow) for a CRUD/data modeling article.

Poem

A rabbit hopped through Postgres trees,
Found B-tree indexes with ease,
Seeded users, five-hundred-thousand strong,
Timed each query, right along,
EXPLAIN ANALYZE sings its plan —
Faster hops since indexes began! 🐇📊

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the PR as a refresh of the B-tree indexes blog post for Prisma ORM 7 and Prisma Postgres.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@argos-ci

argos-ci Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - Jul 7, 2026, 12:49 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants