---
title: "Improving query performance with database indexes using Prisma: B-tree indexes"
url: https://daily.dev/posts/improving-query-performance-with-database-indexes-using-prisma-b-tree-indexes-osvq6v6op
source_url: https://www.prisma.io/blog/improving-query-performance-using-indexes-2-MyoiJNMFTsfq
type: article
source: "Prisma Blog"
published: 2026-05-31T07:44:53.496Z
updated: 2026-05-31T09:26:07.214Z
tags: ["mysql", "prisma"]
reading_time: 8
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Improving query performance with database indexes using Prisma: B-tree indexes

**[Prisma Blog](https://daily.dev/sources/prisma-blog)** · 8 min read · 0 upvotes · 0 comments

## Summary

A practical guide to B-tree indexes and how they improve database query performance using Prisma. Covers the B-tree data structure, its O(log n) time complexity vs. O(n) sequential scans, and when to use B-tree indexes (equality and range operators). Includes a hands-on example with a MySQL-backed REST API seeded with 500K records, demonstrating how adding a `@@index()` in the Prisma schema cuts query time from 174ms to 8ms. Also covers multi-column indexes and sort order configuration.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.prisma.io/blog/improving-query-performance-using-indexes-2-MyoiJNMFTsfq>

## Similar posts on daily.dev

- [Introduction to Postgres Indexes – Frontend Masters Blog](https://daily.dev/posts/introduction-to-postgres-indexes-frontend-masters-blog-ua497z0ze) · Frontend Masters · 16 upvotes · 0 comments
- [How Database Indexes Work – A Practical Guide with PostgreSQL Examples](https://daily.dev/posts/how-database-indexes-work-a-practical-guide-with-postgresql-examples-8anfbdgcl) · freeCodeCamp · 72 upvotes · 0 comments

---

Tags: [#mysql](https://daily.dev/tags/mysql), [#prisma](https://daily.dev/tags/prisma)

[View this post on daily.dev](https://daily.dev/posts/improving-query-performance-with-database-indexes-using-prisma-b-tree-indexes-osvq6v6op)
