# B-Tree Indexes in Prisma ORM: Make Slow Postgres Queries 80x Faster

DevFeed: [B-Tree Indexes in Prisma ORM: Make Slow Postgres Queries 80x Faster](<https://devfeed.tech/articles/b-tree-indexes-in-prisma-orm-make-slow-postgres-queries-80x-faster-47656.md>)

Original publisher: [Read original article](<https://www.prisma.io/blog/improving-query-performance-using-indexes-2-MyoiJNMFTsfq>)

Author: Alex Ruheni

Published: 2022-09-16T00:00:00Z

Content type: tutorial

Language: en

Sources: [Prisma](<https://devfeed.tech/sources/prisma-blog.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Prisma](<https://devfeed.tech/topics/prisma.md>), [Database](<https://devfeed.tech/topics/database.md>), [Object-relational mapping](<https://devfeed.tech/topics/orm.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>)

Tags: [analyze](<https://devfeed.tech/tags/analyze.md>), [b-tree](<https://devfeed.tech/tags/b-tree.md>), [complexity](<https://devfeed.tech/tags/complexity.md>), [data-structure](<https://devfeed.tech/tags/data-structure.md>), [explain](<https://devfeed.tech/tags/explain.md>), [indexes](<https://devfeed.tech/tags/indexes.md>), [orm](<https://devfeed.tech/tags/orm.md>), [postgres](<https://devfeed.tech/tags/postgres.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [prisma](<https://devfeed.tech/tags/prisma.md>), [queries](<https://devfeed.tech/tags/queries.md>), [time-complexity](<https://devfeed.tech/tags/time-complexity.md>)

## AI overview

A practical tutorial on using B-tree indexes in a Prisma ORM schema to improve PostgreSQL query performance. It explains how B-tree indexes work and reports a verified reduction in query time from roughly 66 milliseconds to under 1 millisecond on 500,000 rows using Prisma ORM 7.8 and PostgreSQL 17.

## Source excerpt

Add a B-tree index in your Prisma schema with @@index and turn a 66ms sequential scan into a sub-millisecond lookup, an 80x improvement verified on Prisma ORM 7 and PostgreSQL 17 with EXPLAIN ANALYZE.