Query translation layer
Prisma आपके query inputs को database-specific SQL में translate करता है। इससे cross-database behavior और Prisma की API semantics संभव होती हैं, लेकिन database तक SQL पहुँचने से पहले processing time बढ़ जाता है।
क्या Prisma धीमा है? आप अकेले नहीं हैं। Prisma का DX पसंद है लेकिन बेहतर performance चाहिए?
धीमी Prisma क्वेरी को 2–7× तेज़ करें (SQLite relation filters पर 53.5× तक) बिना किसी existing query को बदले।
import { PrismaClient, Prisma } from '@prisma/client'
import { speedExtension, convertDMMFToModels } from 'prisma-sql'
import postgres from 'postgres'
const sql = postgres(process.env.DATABASE_URL)
const models = convertDMMFToModels(Prisma.dmmf.datamodel)
const prisma = new PrismaClient().$extends(
speedExtension({ postgres: sql, models })
)
const users = await prisma.user.findMany({
where: { status: 'ACTIVE' },
include: { posts: true }
}) Prisma के evolution और performance characteristics समझने से पता चलता है कि यह extension क्यों मौजूद है।
Prisma 2 2019 में लॉन्च हुआ, जिसने type-safe database access और schema से generated types के साथ TypeScript ORM landscape बदल दिया। Prisma ने engine-based architecture पेश किया जो queries को translate और validate करता है, और ऐसी guarantees देता है जिन्हें traditional JavaScript ORMs के साथ पाना मुश्किल था।
Prisma ने nested writes, transactions, और middleware जैसी शक्तिशाली सुविधाएँ जोड़ीं। फीचर्स बढ़े, लेकिन हर query को architectural cost फिर भी देना पड़ा: queries represent, validate, execute होती हैं, और results Prisma API के अनुरूप shape किए जाते हैं।
जैसे-जैसे ज़्यादा teams ने high-traffic workloads में Prisma deploy किया, per-query fixed overhead measurable हो गया। यह read-heavy endpoints, analytics, aggregations, और बड़े result sets पर सबसे ज़्यादा दिखता है। यह overhead bug नहीं है; यह Prisma की guarantees और API behavior की cost है।
Prisma ने performance और engine changes पर केंद्रित बड़े updates ship किए। Improvements के बाद भी raw SQL को सीधे execute करने की तुलना में parsing, validating, planning, और result shaping की unavoidable cost बनी रहती है।
यह extension read performance पर केंद्रित है। यह findMany, findFirst, findUnique, count, aggregate, और groupBy के लिए Prisma की read execution path को bypass करता है, जबकि writes, migrations, schema management, और type generation के लिए Prisma को रखता है। rollout से पहले अपनी Prisma version के साथ compatibility validate करें।
Prisma ने अपने लक्ष्यों के लिए सही architectural choices कीं: type safety, developer experience, और cross-database behavior। लेकिन ये choices scale पर noticeable overhead बनाती हैं। यह extension Prisma को replace नहीं करता—यह उन teams के लिए reads optimize करता है जो Prisma का DX भी चाहते हैं और जहाँ ज़रूरी हो वहाँ तेज़ execution भी।
Prisma आपके query inputs को database-specific SQL में translate करता है। इससे cross-database behavior और Prisma की API semantics संभव होती हैं, लेकिन database तक SQL पहुँचने से पहले processing time बढ़ जाता है।
Prisma schema के खिलाफ queries validate करता है और API-level guarantees enforce करता है। ये safeguards bugs की कुछ classes रोकते हैं, लेकिन हर query में overhead जोड़ते हैं।
Results को Prisma के API behavior के अनुरूप shape किया जाता है। यह DX और consistency के लिए अच्छा है, लेकिन latency बढ़ाता है—खासकर बड़े result sets और complex includes में।
यह extension Prisma को complement करता है, read queries के लिए एक तेज़ path देकर। आप Prisma की पसंदीदा चीज़ें रखते हैं और typical cases में 2–7× तेज़ reads (और SQLite relation filters में 53.5× तक) पाते हैं जब performance मायने रखती है।
Prisma v6, v7, Drizzle ORM और Prisma-SQL के बीच व्यापक तुलना
बेंचमार्क वातावरण: MacBook Pro M1 • PostgreSQL 15 • SQLite 3.43 • प्रति डेटाबेस 137 टेस्ट केस
57 टेस्ट केस का औसत
56 टेस्ट केस का औसत
बेंचमार्क प्रति डेटाबेस 137 E2E टेस्ट पर आधारित हैं। Prisma v6.16.3, Prisma v7.2.0, Drizzle ORM latest. पूरा बेंचमार्क डेटा देखें →
Welch के t-test और 1ms व्यावहारिक महत्व सीमा के साथ सांख्यिकीय तुलना
ये परिणाम रनटाइम मोड को दर्शाते हैं, जहाँ प्रत्येक अनुरोध पर क्वेरी को SQL में परिवर्तित किया जाता है। प्रीरेंडर्ड मोड में, SQL बिल्ड समय पर उत्पन्न होता है — रनटाइम बिना किसी रूपांतरण ओवरहेड के कच्ची पैरामीटराइज़्ड क्वेरियाँ निष्पादित करता है।
| परीक्षण | Prisma | prisma-sql | Drizzle | गति वृद्धि | महत्व | CV% | n |
|---|---|---|---|---|---|---|---|
| findMany basic | 0.536ms ±0.016 | 0.272ms ±0.043 | 1.37ms | ~1.00x | ≈ | 57.0% | 50 |
| findMany where = | 0.596ms ±0.046 | 0.354ms ±0.022 | 0.442ms | ~1.00x | ≈ | 22.3% | 50 |
| findMany where >= | 16.48ms ±0.251 | 4.89ms ±0.382 | 6.48ms | 3.37x 1.33x D | *** | 28.2% | 50 |
| findMany where IN | 0.609ms ±0.034 | 0.325ms ±0.016 | 0.436ms | ~1.00x | ≈ | 17.5% | 50 |
| findMany where null | 0.254ms ±0.0094 | 0.122ms ±0.0030 | 0.167ms | ~1.00x | ≈ | 8.7% | 50 |
| findMany ILIKE | 0.290ms ±0.043 | 0.231ms ±0.0083 | 0.296ms | ~1.00x | ≈ | 13.2% | 50 |
| findMany AND | 2.77ms ±0.076 | 1.00ms ±0.109 | 2.12ms | 2.77x 2.12x D | *** | 39.3% | 50 |
| findMany OR | 14.10ms ±0.361 | 4.05ms ±0.388 | 6.96ms | 3.48x 1.72x D | *** | 34.6% | 50 |
| findMany NOT | 0.631ms ±0.042 | 0.363ms ±0.026 | 0.454ms | ~1.00x | ≈ | 26.3% | 50 |
| findMany orderBy | 2.11ms ±0.080 | 0.893ms ±0.081 | 1.12ms | 2.36x 1.25x D | *** | 32.7% | 50 |
| findMany pagination | 0.248ms ±0.013 | 0.217ms ±0.0089 | 0.228ms | ~1.00x | ≈ | 14.9% | 50 |
| findMany select | 0.309ms ±0.058 | 0.101ms ±0.0064 | 0.116ms | ~1.00x | ≈ | 22.6% | 50 |
| findMany relation some | 0.910ms ±0.030 | 0.450ms ±0.016 | — | ~1.00x | ≈ | 12.6% | 50 |
| findMany relation every | 0.710ms ±0.026 | 0.491ms ±0.012 | — | ~1.00x | ≈ | 8.7% | 50 |
| findMany relation none | 31.70ms ±4.16 | 7.65ms ±0.483 | — | 4.15x | *** | 22.8% | 50 |
| findMany nested relation | 0.952ms ±0.088 | 1.06ms ±0.138 | — | ~1.00x | ≈ | 46.7% | 50 |
| findMany complex | 1.12ms ±0.029 | 0.520ms ±0.017 | 0.651ms | ~1.00x | ≈ | 11.7% | 50 |
| findFirst | 0.240ms ±0.013 | 0.195ms ±0.014 | 0.262ms | ~1.00x | ≈ | 25.0% | 50 |
| findFirst skip | 0.284ms ±0.018 | 0.176ms ±0.0080 | 0.219ms | ~1.00x | ≈ | 16.7% | 50 |
| findUnique id | 0.220ms ±0.016 | 0.163ms ±0.028 | 0.167ms | ~1.00x | ≈ | 61.9% | 50 |
| findUnique email | 0.180ms ±0.012 | 0.104ms ±0.0075 | 0.133ms | ~1.00x | ≈ | 26.0% | 50 |
| count | 0.124ms ±0.026 | 0.048ms ±0.0019 | 0.063ms | ~1.00x | ≈ | 13.8% | 50 |
| count where | 0.435ms ±0.0094 | 0.265ms ±0.011 | 0.273ms | ~1.00x | ≈ | 15.4% | 50 |
| aggregate count | 0.230ms ±0.0069 | 0.151ms ±0.0028 | — | ~1.00x | ≈ | 6.5% | 50 |
| aggregate sum/avg | 0.355ms ±0.018 | 0.263ms ±0.013 | — | ~1.00x | ≈ | 18.0% | 50 |
| aggregate where | 0.438ms ±0.010 | 0.275ms ±0.014 | — | ~1.00x | ≈ | 18.9% | 50 |
| aggregate min/max | 0.344ms ±0.015 | 0.289ms ±0.031 | — | ~1.00x | ≈ | 38.6% | 50 |
| aggregate complete | 0.420ms ±0.014 | 0.317ms ±0.033 | — | ~1.00x | ≈ | 37.4% | 50 |
| groupBy | 0.447ms ±0.015 | 0.339ms ±0.011 | — | ~1.00x | ≈ | 11.4% | 50 |
| groupBy count | 0.461ms ±0.011 | 0.381ms ±0.014 | — | ~1.00x | ≈ | 13.0% | 50 |
| groupBy multi | 0.573ms ±0.019 | 0.431ms ±0.0097 | — | ~1.00x | ≈ | 8.1% | 50 |
| groupBy having | 0.585ms ±0.034 | 0.473ms ±0.011 | — | ~1.00x | ≈ | 8.6% | 50 |
| groupBy + where | 0.596ms ±0.031 | 0.431ms ±0.038 | — | ~1.00x | ≈ | 31.5% | 50 |
| _count via include | 0.702ms ±0.023 | 0.704ms ±0.040 | — | ~1.00x | ≈ | 20.4% | 50 |
| _count via include + relations | 1.86ms ±0.108 | 1.48ms ±0.072 | — | ~1.00x | ≈ | 17.7% | 50 |
| groupBy aggregates | 0.576ms ±0.027 | 0.578ms ±0.062 | — | ~1.00x | ≈ | 38.8% | 50 |
| groupBy min/max | 0.571ms ±0.048 | 0.589ms ±0.073 | — | ~1.00x | ≈ | 44.8% | 50 |
| include list + nested to-one | 1.77ms ±0.103 | 0.460ms ±0.034 | — | 3.86x | *** | 26.9% | 50 |
| include list + nullable to-one | 2.77ms ±0.100 | 2.14ms ±0.170 | — | ~1.00x | ≈ | 28.6% | 50 |
| include posts | 2.86ms ±0.201 | 1.07ms ±0.069 | 6.00ms | 2.66x 5.58x D | *** | 23.2% | 50 |
| include profile | 0.533ms ±0.027 | 0.489ms ±0.030 | 0.549ms | ~1.00x | ≈ | 21.8% | 50 |
| include 3 levels | 1.99ms ±0.100 | 1.70ms ±0.190 | 1.96ms | ~1.00x | ≈ | 40.2% | 50 |
| include 4 levels | 2.45ms ±0.103 | 1.25ms ±0.030 | 3.81ms | 1.96x 3.05x D | *** | 8.8% | 50 |
| include + where | 2.61ms ±0.100 | 0.948ms ±0.100 | 4.59ms | 2.76x 4.84x D | *** | 38.1% | 50 |
| include + select nested | 2.27ms ±0.124 | 1.34ms ±0.106 | 3.71ms | ~1.00x | ≈ | 28.5% | 50 |
| findMany startsWith | 0.282ms ±0.031 | 0.185ms ±0.030 | 0.230ms | ~1.00x | ≈ | 58.7% | 50 |
| findMany endsWith | 0.640ms ±0.057 | 0.296ms ±0.049 | 0.470ms | ~1.00x | ≈ | 59.0% | 50 |
| findMany NOT contains | 0.661ms ±0.024 | 0.329ms ±0.050 | 0.413ms | ~1.00x | ≈ | 55.1% | 50 |
| findMany LIKE | 0.257ms ±0.026 | 0.181ms ±0.0061 | 0.208ms | ~1.00x | ≈ | 12.3% | 50 |
| findMany < | 27.72ms ±2.31 | 6.64ms ±0.325 | 11.44ms | 4.18x 1.72x D | *** | 17.7% | 50 |
| findMany <= | 28.41ms ±0.842 | 6.96ms ±0.419 | 11.50ms | 4.08x 1.65x D | *** | 21.7% | 50 |
| findMany > | 18.50ms ±3.09 | 4.00ms ±0.196 | 6.24ms | 4.63x 1.56x D | *** | 17.7% | 50 |
| findMany NOT IN | 0.593ms ±0.032 | 0.285ms ±0.012 | 0.351ms | ~1.00x | ≈ | 15.4% | 50 |
| findMany isNot null | 0.580ms ±0.017 | 0.194ms ±0.0036 | 0.294ms | ~1.00x | ≈ | 6.6% | 50 |
| orderBy multi-field | 5.19ms ±0.480 | 3.14ms ±1.04 | 1.51ms | 1.66x 0.48x D | ** | 119.3% | 50 |
| orderBy relation to-one | 2.38ms ±0.066 | 1.72ms ±0.131 | — | ~1.00x | ≈ | 27.5% | 50 |
| orderBy relation + scalar | 2.22ms ±0.039 | 1.69ms ±0.093 | — | ~1.00x | ≈ | 19.9% | 50 |
| orderBy nullable relation | 1.94ms ±0.056 | 1.30ms ±0.058 | — | ~1.00x | ≈ | 16.0% | 50 |
| orderBy deep relation | 2.45ms ±0.070 | 1.73ms ±0.040 | — | ~1.00x | ≈ | 8.3% | 50 |
| orderBy deep relation + scalar | 3.38ms ±0.250 | 2.07ms ±0.053 | — | 1.63x | *** | 9.2% | 50 |
| distinct status | 11.52ms ±2.73 | 1.38ms ±0.137 | — | 8.33x | *** | 35.8% | 50 |
| distinct multi | 14.12ms ±0.732 | 2.60ms ±0.054 | — | 5.43x | *** | 7.5% | 50 |
| cursor composite tuple | 1.97ms ±0.081 | 1.50ms ±0.081 | — | ~1.00x | ≈ | 19.4% | 50 |
| cursor composite desc | 2.91ms ±1.29 | 1.66ms ±0.135 | — | 1.75x | ns | 29.4% | 50 |
| cursor prefix of orderBy | 2.03ms ±0.074 | 1.38ms ±0.040 | — | ~1.00x | ≈ | 10.4% | 50 |
| select + include | 1.19ms ±0.081 | 0.254ms ±0.015 | 0.415ms | ~1.00x | ≈ | 21.8% | 50 |
| _count relation | 0.898ms ±0.070 | 0.648ms ±0.034 | — | ~1.00x | ≈ | 19.2% | 50 |
| _count multi-relation | 0.244ms ±0.014 | 0.172ms ±0.0080 | — | ~1.00x | ≈ | 17.1% | 50 |
| _count inside include | 1.37ms ±0.055 | 1.35ms ±0.130 | — | ~1.00x | ≈ | 34.7% | 50 |
| _count inside nested select | 1.91ms ±0.049 | 1.43ms ±0.057 | — | ~1.00x | ≈ | 14.4% | 50 |
| _count deep include | 1.92ms ±0.040 | 1.40ms ±0.044 | — | ~1.00x | ≈ | 11.4% | 50 |
| ILIKE special chars | 0.511ms ±0.262 | 0.177ms ±0.0064 | — | ~1.00x | ≈ | 12.8% | 50 |
| LIKE case sensitive | 0.213ms ±0.012 | 0.164ms ±0.0053 | — | ~1.00x | ≈ | 11.5% | 50 |
| findMany Date range | 0.368ms ±0.018 | 0.517ms ±0.019 | 0.833ms | ~1.00x | ≈ | 13.6% | 50 |
| count Date range | 0.508ms ±0.016 | 0.817ms ±0.295 | 0.438ms | ~1.00x | ≈ | 130.1% | 50 |
| findMany Date gte | 0.387ms ±0.032 | 0.184ms ±0.0025 | 0.242ms | ~1.00x | ≈ | 5.0% | 50 |
| depth-1 low-fan | 0.502ms ±0.045 | 0.666ms ±0.303 | — | ~1.00x | ≈ | 164.1% | 50 |
| depth-1 mid-fan | 3.02ms ±0.187 | 1.26ms ±0.148 | — | 2.40x | *** | 42.3% | 50 |
| depth-1 high-fan | 3.49ms ±0.138 | 1.01ms ±0.066 | — | 3.44x | *** | 23.3% | 50 |
| depth-1 wide | 6.05ms ±1.65 | 1.51ms ±0.104 | — | 4.00x | *** | 24.8% | 50 |
| depth-1 unbound | 43.36ms ±2.79 | 8.43ms ±0.343 | — | 5.14x | *** | 14.7% | 50 |
| depth-2 | 3.79ms ±0.176 | 2.60ms ±0.150 | — | 1.45x | *** | 20.8% | 50 |
| depth-2 paginated Project→tasks | 1.52ms ±0.067 | 1.66ms ±0.174 | — | ~1.00x | ≈ | 37.9% | 50 |
| depth-2 high-fan | 2.14ms ±0.044 | 1.21ms ±0.060 | — | ~1.00x | ≈ | 18.1% | 50 |
| depth-2 wide | 5.24ms ±0.307 | 1.92ms ±0.179 | — | 2.73x | *** | 33.8% | 50 |
| depth-2 unbound | 78.61ms ±23.12 | 13.71ms ±0.633 | — | 5.74x | *** | 7.5% | 10 |
| depth-3 unbound | 16.38ms ±1.37 | 6.59ms ±0.241 | — | 2.49x | *** | 13.2% | 50 |
| depth-3 paginated | 2.04ms ±0.117 | 2.19ms ±0.542 | — | ~1.00x | ≈ | 89.3% | 50 |
| depth-4 unbound | 9.62ms ±0.235 | 3.27ms ±0.186 | — | 2.94x | *** | 20.5% | 50 |
| depth-4 paginated | 2.56ms ±0.095 | 1.78ms ±0.230 | — | ~1.00x | ≈ | 46.4% | 50 |
| findFirst depth-2 | 3.53ms ±0.968 | 1.52ms ±0.134 | — | 2.33x | *** | 32.0% | 50 |
| findUnique depth-2 Project→tasks→comment | 2.77ms ±0.164 | 2.94ms ±0.761 | — | ~1.00x | ≈ | 93.5% | 50 |
| complex nested select | 5.70ms ±0.317 | 4.49ms ±0.196 | — | 1.27x | *** | 15.7% | 50 |
| ultra deep query | 7.62ms ±0.180 | 11.97ms ±5.92 | — | 0.64x | ns | 178.5% | 50 |
| transaction: (3 operations) | 2.91ms ±0.054 | 1.23ms ±0.069 | — | 2.37x | *** | 20.4% | 50 |
| परीक्षण | Prisma | prisma-sql | Drizzle | गति वृद्धि | महत्व | CV% | n |
|---|---|---|---|---|---|---|---|
| findMany basic | 1.27ms ±0.457 | 0.050ms ±0.0089 | 0.328ms | 25.43x 6.56x D | *** | 63.6% | 50 |
| findMany where = | 0.483ms ±0.044 | 0.054ms ±0.011 | 0.171ms | ~1.00x | ≈ | 74.1% | 50 |
| findMany where >= | 14.35ms ±0.337 | 1.09ms ±0.068 | 2.48ms | 13.10x 2.27x D | *** | 22.6% | 50 |
| findMany where IN | 0.457ms ±0.019 | 0.051ms ±0.014 | 0.113ms | ~1.00x | ≈ | 100.0% | 50 |
| findMany where null | 0.185ms ±0.013 | 0.016ms ±0.0011 | 0.060ms | ~1.00x | ≈ | 24.8% | 50 |
| findMany AND | 1.69ms ±0.051 | 0.296ms ±0.040 | 0.464ms | 5.70x 1.57x D | *** | 48.5% | 50 |
| findMany OR | 13.95ms ±1.67 | 1.02ms ±0.068 | 2.69ms | 13.65x 2.63x D | *** | 24.0% | 50 |
| findMany NOT | 0.504ms ±0.027 | 0.049ms ±0.0072 | 0.106ms | ~1.00x | ≈ | 53.1% | 50 |
| findMany orderBy | 2.67ms ±0.108 | 1.98ms ±0.056 | 2.07ms | ~1.00x | ≈ | 10.2% | 50 |
| findMany pagination | 0.213ms ±0.049 | 0.030ms ±0.0014 | 0.067ms | ~1.00x | ≈ | 16.9% | 50 |
| findMany select | 0.195ms ±0.015 | 0.024ms ±0.0006 | 0.042ms | ~1.00x | ≈ | 10.4% | 50 |
| findMany relation some | 5.20ms ±0.132 | 0.424ms ±0.011 | — | 12.27x | *** | 9.2% | 50 |
| findMany relation every | 11.95ms ±1.31 | 7.06ms ±0.751 | — | 1.69x | *** | 38.4% | 50 |
| findMany relation none | 182.68ms ±6.37 | 2.63ms ±0.306 | — | 69.35x | *** | 18.7% | 10 |
| findMany nested relation | 1.23ms ±0.053 | 0.328ms ±0.022 | — | ~1.00x | ≈ | 23.8% | 50 |
| findMany complex | 0.982ms ±0.107 | 0.447ms ±0.017 | 0.490ms | ~1.00x | ≈ | 14.1% | 50 |
| findFirst | 0.159ms ±0.0050 | 0.013ms ±0.0022 | 0.068ms | ~1.00x | ≈ | 64.0% | 50 |
| findFirst skip | 0.196ms ±0.0050 | 0.015ms ±0.0036 | 0.085ms | ~1.00x | ≈ | 85.1% | 50 |
| findUnique id | 0.138ms ±0.0086 | 0.010ms ±0.0006 | 0.058ms | ~1.00x | ≈ | 21.4% | 50 |
| findUnique email | 0.138ms ±0.025 | 0.011ms ±0.0003 | 0.051ms | ~1.00x | ≈ | 13.0% | 50 |
| count | 0.071ms ±0.0033 | 0.0080ms ±0.0022 | 0.015ms | ~1.00x | ≈ | 99.8% | 50 |
| count where | 0.271ms ±0.0067 | 0.153ms ±0.0028 | 0.169ms | ~1.00x | ≈ | 6.2% | 50 |
| _count via include | 0.560ms ±0.016 | 0.350ms ±0.0094 | — | ~1.00x | ≈ | 9.7% | 50 |
| _count via include + relations | 1.24ms ±0.041 | 0.634ms ±0.034 | — | ~1.00x | ≈ | 19.3% | 50 |
| aggregate count | 0.170ms ±0.015 | 0.015ms ±0.0011 | — | ~1.00x | ≈ | 26.0% | 50 |
| aggregate sum/avg | 0.308ms ±0.013 | 0.165ms ±0.0053 | — | ~1.00x | ≈ | 11.5% | 50 |
| aggregate where | 0.293ms ±0.014 | 0.168ms ±0.0086 | — | ~1.00x | ≈ | 18.5% | 50 |
| aggregate min/max | 0.334ms ±0.027 | 0.174ms ±0.0061 | — | ~1.00x | ≈ | 12.6% | 50 |
| aggregate complete | 0.447ms ±0.017 | 0.239ms ±0.0083 | — | ~1.00x | ≈ | 12.4% | 50 |
| groupBy | 0.682ms ±0.032 | 0.467ms ±0.014 | — | ~1.00x | ≈ | 10.9% | 50 |
| groupBy count | 0.608ms ±0.019 | 0.474ms ±0.012 | — | ~1.00x | ≈ | 8.9% | 50 |
| groupBy multi | 1.29ms ±0.026 | 1.56ms ±0.256 | — | ~1.00x | ≈ | 59.1% | 50 |
| groupBy having | 0.762ms ±0.021 | 0.521ms ±0.013 | — | ~1.00x | ≈ | 9.3% | 50 |
| groupBy + where | 0.366ms ±0.025 | 0.210ms ±0.011 | — | ~1.00x | ≈ | 19.1% | 50 |
| groupBy aggregates | 0.764ms ±0.016 | 0.584ms ±0.012 | — | ~1.00x | ≈ | 7.6% | 50 |
| groupBy min/max | 0.808ms ±0.023 | 0.594ms ±0.0097 | — | ~1.00x | ≈ | 5.9% | 50 |
| include posts | 2.38ms ±0.167 | 0.358ms ±0.025 | 1.37ms | 6.64x 3.82x D | *** | 25.4% | 50 |
| include profile | 0.344ms ±0.014 | 0.055ms ±0.0089 | 0.233ms | ~1.00x | ≈ | 57.7% | 50 |
| include 3 levels | 1.15ms ±0.026 | 1.09ms ±0.037 | 0.934ms | ~1.00x | ≈ | 12.2% | 50 |
| include 4 levels | 1.21ms ±0.037 | 1.35ms ±0.055 | 0.669ms | ~1.00x | ≈ | 14.6% | 50 |
| include + where | 0.779ms ±0.018 | 0.249ms ±0.020 | 0.298ms | ~1.00x | ≈ | 29.0% | 50 |
| include + select nested | 0.800ms ±0.022 | 0.255ms ±0.012 | 1.09ms | ~1.00x | ≈ | 16.5% | 50 |
| findMany startsWith | 0.182ms ±0.011 | 0.029ms ±0.0014 | 0.071ms | ~1.00x | ≈ | 18.9% | 50 |
| findMany endsWith | 0.523ms ±0.033 | 0.049ms ±0.0008 | 0.119ms | ~1.00x | ≈ | 6.7% | 50 |
| findMany NOT contains | 0.495ms ±0.019 | 0.041ms ±0.0047 | 0.118ms | ~1.00x | ≈ | 40.3% | 50 |
| findMany LIKE | 0.165ms ±0.0086 | 0.025ms ±0.0006 | 0.053ms | ~1.00x | ≈ | 9.6% | 50 |
| findMany < | 23.59ms ±0.540 | 2.10ms ±0.136 | 4.24ms | 11.22x 2.02x D | *** | 23.3% | 50 |
| findMany <= | 24.61ms ±1.07 | 2.23ms ±0.145 | 4.19ms | 11.02x 1.88x D | *** | 23.4% | 50 |
| findMany > | 16.00ms ±1.88 | 0.967ms ±0.044 | 2.22ms | 16.56x 2.29x D | *** | 16.5% | 50 |
| findMany NOT IN | 0.451ms ±0.018 | 0.057ms ±0.028 | 0.109ms | ~1.00x | ≈ | 176.8% | 50 |
| findMany isNot null | 0.457ms ±0.011 | 0.034ms ±0.0011 | 0.121ms | ~1.00x | ≈ | 12.2% | 50 |
| orderBy multi-field | 0.704ms ±0.024 | 0.353ms ±0.016 | 0.442ms | ~1.00x | ≈ | 16.4% | 50 |
| orderBy relation to-one | 0.740ms ±0.058 | 0.319ms ±0.012 | — | ~1.00x | ≈ | 13.2% | 50 |
| orderBy relation + scalar | 0.778ms ±0.019 | 0.397ms ±0.012 | — | ~1.00x | ≈ | 11.2% | 50 |
| orderBy nullable relation | 2.77ms ±1.29 | 0.329ms ±0.012 | — | 8.41x | ** | 12.9% | 50 |
| orderBy deep relation | 0.960ms ±0.086 | 0.628ms ±0.134 | — | ~1.00x | ≈ | 77.0% | 50 |
| orderBy deep relation + scalar | 1.33ms ±0.062 | 0.868ms ±0.081 | — | ~1.00x | ≈ | 33.8% | 50 |
| distinct status | 13.25ms ±0.695 | 4.59ms ±0.082 | — | 2.89x | *** | 6.4% | 50 |
| distinct multi | 13.35ms ±0.167 | 5.48ms ±0.113 | — | 2.43x | *** | 7.4% | 50 |
| select + include | 0.878ms ±0.281 | 0.245ms ±0.0100 | 0.580ms | ~1.00x | ≈ | 14.5% | 50 |
| _count relation | 0.696ms ±0.026 | 0.358ms ±0.019 | — | ~1.00x | ≈ | 19.1% | 50 |
| _count multi-relation | 0.188ms ±0.034 | 0.043ms ±0.0058 | — | ~1.00x | ≈ | 47.8% | 50 |
| _count inside include | 1.00ms ±0.046 | 0.549ms ±0.026 | — | ~1.00x | ≈ | 16.9% | 50 |
| _count inside nested select | 1.83ms ±0.078 | 1.29ms ±0.064 | — | ~1.00x | ≈ | 17.7% | 50 |
| _count deep include | 1.55ms ±0.055 | 1.25ms ±0.065 | — | ~1.00x | ≈ | 18.6% | 50 |
| findMany Date range | 0.273ms ±0.013 | 0.037ms ±0.0011 | 0.257ms | ~1.00x | ≈ | 12.1% | 50 |
| findMany Date gte | 0.276ms ±0.018 | 0.035ms ±0.0006 | 0.095ms | ~1.00x | ≈ | 7.1% | 50 |
| depth-1 low-fan Project→labels | 0.395ms ±0.049 | 0.050ms ±0.0094 | — | ~1.00x | ≈ | 67.2% | 50 |
| depth-1 mid-fan Project→tasks | 3.14ms ±0.434 | 0.559ms ±0.100 | — | 5.62x | *** | 64.1% | 50 |
| depth-1 high-fan User→assignedTasks | 1.95ms ±0.066 | 0.336ms ±0.039 | — | 5.81x | *** | 41.5% | 50 |
| depth-1 wide | 1.64ms ±0.061 | 0.297ms ±0.012 | — | 5.50x | *** | 14.9% | 50 |
| depth-1 no-limit Project→tasks | 44.56ms ±4.72 | 3.77ms ±0.780 | — | 11.83x | *** | 74.6% | 50 |
| depth-2 | 2.55ms ±0.230 | 0.444ms ±0.060 | — | 5.74x | *** | 49.1% | 50 |
| depth-2 paginated | 2.17ms ±1.03 | 0.466ms ±0.068 | — | 4.65x | ** | 52.7% | 50 |
| depth-2 high-fan | 2.63ms ±0.331 | 0.375ms ±0.041 | — | 6.99x | *** | 39.6% | 50 |
| depth-2 wide+attach+activity | 3.24ms ±0.402 | 0.724ms ±0.119 | — | 4.47x | *** | 59.1% | 50 |
| depth-2 no-limit | 55.16ms ±5.87 | 6.05ms ±0.268 | — | 9.12x | *** | 7.1% | 10 |
| depth-3 | 14.10ms ±1.73 | 1.35ms ±0.102 | — | 10.41x | *** | 27.1% | 50 |
| depth-3 paginated | 1.21ms ±0.035 | 1.20ms ±0.097 | — | ~1.00x | ≈ | 29.1% | 50 |
| depth-4 | 7.46ms ±0.728 | 0.884ms ±0.094 | — | 8.44x | *** | 38.3% | 50 |
| depth-4 paginated | 1.26ms ±0.042 | 1.35ms ±0.065 | — | ~1.00x | ≈ | 17.4% | 50 |
| findFirst depth-2 | 1.07ms ±0.065 | 0.266ms ±0.024 | — | ~1.00x | ≈ | 32.4% | 50 |
| findUnique depth-2 | 0.988ms ±0.022 | 0.254ms ±0.0075 | — | ~1.00x | ≈ | 10.8% | 50 |
| परीक्षण | Prisma | prisma-sql | Drizzle | गति वृद्धि | महत्व | CV% | n |
|---|---|---|---|---|---|---|---|
| findMany basic | 0.317ms ±0.047 | 0.235ms ±0.038 | 0.303ms | ~1.00x | ≈ | 58.5% | 50 |
| findMany where = | 0.268ms ±0.039 | 0.242ms ±0.0089 | 0.383ms | ~1.00x | ≈ | 13.1% | 50 |
| findMany where >= | 8.58ms ±0.369 | 6.22ms ±1.33 | 7.64ms | 1.38x 1.23x D | ** | 77.1% | 50 |
| findMany where IN | 0.363ms ±0.044 | 0.368ms ±0.022 | 0.428ms | ~1.00x | ≈ | 21.4% | 50 |
| findMany where null | 0.191ms ±0.018 | 0.138ms ±0.0067 | 0.186ms | ~1.00x | ≈ | 17.3% | 50 |
| findMany ILIKE | 0.132ms ±0.022 | 0.224ms ±0.044 | 0.160ms | ~1.00x | ≈ | 70.4% | 50 |
| findMany AND | 1.19ms ±0.092 | 0.607ms ±0.052 | 1.30ms | ~1.00x | ≈ | 31.1% | 50 |
| findMany OR | 7.40ms ±0.330 | 4.01ms ±0.525 | 6.19ms | 1.84x 1.54x D | *** | 47.2% | 50 |
| findMany NOT | 0.369ms ±0.041 | 0.592ms ±0.225 | 0.438ms | ~1.00x | ≈ | 137.2% | 50 |
| findMany orderBy | 1.87ms ±0.063 | 0.900ms ±0.100 | 0.792ms | ~1.00x | ≈ | 40.0% | 50 |
| findMany pagination | 0.147ms ±0.0086 | 0.253ms ±0.044 | 0.207ms | ~1.00x | ≈ | 62.8% | 50 |
| findMany select | 0.155ms ±0.030 | 0.118ms ±0.017 | 0.109ms | ~1.00x | ≈ | 51.5% | 50 |
| findMany relation some | 0.635ms ±0.052 | 0.492ms ±0.042 | — | ~1.00x | ≈ | 31.0% | 50 |
| findMany relation every | 0.587ms ±0.026 | 0.530ms ±0.050 | — | ~1.00x | ≈ | 34.0% | 50 |
| findMany relation none | 13.00ms ±0.731 | 6.21ms ±0.271 | — | 2.09x | *** | 15.8% | 50 |
| findMany nested relation | 0.652ms ±0.060 | 0.623ms ±0.065 | — | ~1.00x | ≈ | 37.8% | 50 |
| findMany complex | 0.782ms ±0.032 | 0.537ms ±0.027 | 0.572ms | ~1.00x | ≈ | 18.4% | 50 |
| findFirst | 0.143ms ±0.011 | 0.236ms ±0.070 | 0.233ms | ~1.00x | ≈ | 107.2% | 50 |
| findFirst skip | 0.170ms ±0.015 | 0.181ms ±0.021 | 0.229ms | ~1.00x | ≈ | 40.8% | 50 |
| findUnique id | 0.142ms ±0.022 | 0.147ms ±0.0036 | 0.133ms | ~1.00x | ≈ | 8.8% | 50 |
| findUnique email | 0.104ms ±0.0055 | 0.117ms ±0.031 | 0.143ms | ~1.00x | ≈ | 95.9% | 50 |
| count | 0.096ms ±0.019 | 0.049ms ±0.0011 | 0.060ms | ~1.00x | ≈ | 7.8% | 50 |
| count where | 0.407ms ±0.034 | 0.277ms ±0.018 | 0.287ms | ~1.00x | ≈ | 23.4% | 50 |
| aggregate count | 0.197ms ±0.0067 | 0.157ms ±0.017 | — | ~1.00x | ≈ | 39.2% | 50 |
| aggregate sum/avg | 0.336ms ±0.037 | 0.262ms ±0.018 | — | ~1.00x | ≈ | 25.1% | 50 |
| aggregate where | 0.422ms ±0.032 | 0.297ms ±0.034 | — | ~1.00x | ≈ | 40.8% | 50 |
| aggregate min/max | 0.293ms ±0.014 | 0.258ms ±0.0039 | — | ~1.00x | ≈ | 5.6% | 50 |
| aggregate complete | 0.349ms ±0.021 | 0.303ms ±0.017 | — | ~1.00x | ≈ | 20.8% | 50 |
| groupBy | 0.423ms ±0.040 | 0.378ms ±0.033 | — | ~1.00x | ≈ | 31.4% | 50 |
| groupBy count | 0.584ms ±0.092 | 0.450ms ±0.045 | — | ~1.00x | ≈ | 36.5% | 50 |
| groupBy multi | 0.497ms ±0.029 | 0.486ms ±0.034 | — | ~1.00x | ≈ | 25.1% | 50 |
| groupBy having | 0.439ms ±0.033 | 0.481ms ±0.042 | — | ~1.00x | ≈ | 31.5% | 50 |
| groupBy + where | 0.444ms ±0.018 | 0.376ms ±0.024 | — | ~1.00x | ≈ | 22.8% | 50 |
| _count via include | 0.691ms ±0.053 | 0.703ms ±0.033 | — | ~1.00x | ≈ | 17.0% | 50 |
| _count via include + relations | 1.32ms ±0.065 | 1.42ms ±0.078 | — | ~1.00x | ≈ | 19.7% | 50 |
| groupBy aggregates | 0.473ms ±0.026 | 0.494ms ±0.048 | — | ~1.00x | ≈ | 35.3% | 50 |
| groupBy min/max | 0.463ms ±0.021 | 0.440ms ±0.016 | — | ~1.00x | ≈ | 12.6% | 50 |
| include list + nested to-one | 1.07ms ±0.064 | 0.450ms ±0.037 | — | ~1.00x | ≈ | 29.8% | 50 |
| include list + nullable to-one | 1.41ms ±0.094 | 1.70ms ±0.060 | — | ~1.00x | ≈ | 12.6% | 50 |
| include posts | 1.49ms ±0.259 | 1.07ms ±0.064 | 2.49ms | ~1.00x | ≈ | 21.5% | 50 |
| include profile | 0.286ms ±0.025 | 0.352ms ±0.037 | 0.473ms | ~1.00x | ≈ | 37.7% | 50 |
| include 3 levels | 1.32ms ±0.078 | 1.29ms ±0.042 | 1.60ms | ~1.00x | ≈ | 11.7% | 50 |
| include 4 levels | 1.43ms ±0.050 | 1.13ms ±0.049 | 1.92ms | ~1.00x | ≈ | 15.8% | 50 |
| include + where | 0.790ms ±0.052 | 0.783ms ±0.041 | 1.77ms | ~1.00x | ≈ | 18.9% | 50 |
| include + select nested | 0.697ms ±0.059 | 0.762ms ±0.047 | 1.78ms | ~1.00x | ≈ | 22.1% | 50 |
| findMany startsWith | 0.138ms ±0.015 | 0.155ms ±0.0064 | 0.186ms | ~1.00x | ≈ | 14.9% | 50 |
| findMany endsWith | 0.280ms ±0.043 | 0.307ms ±0.083 | 0.272ms | ~1.00x | ≈ | 97.2% | 50 |
| findMany NOT contains | 0.268ms ±0.043 | 0.208ms ±0.020 | 0.290ms | ~1.00x | ≈ | 33.9% | 50 |
| findMany LIKE | 0.098ms ±0.019 | 0.098ms ±0.0019 | 0.147ms | ~1.00x | ≈ | 7.7% | 50 |
| findMany < | 12.95ms ±0.585 | 5.78ms ±0.233 | 10.30ms | 2.24x 1.78x D | *** | 14.6% | 50 |
| findMany <= | 11.85ms ±0.161 | 6.99ms ±0.681 | 10.48ms | 1.70x 1.50x D | *** | 35.1% | 50 |
| findMany > | 8.08ms ±0.424 | 3.79ms ±0.186 | 5.86ms | 2.13x 1.55x D | *** | 17.8% | 50 |
| findMany NOT IN | 0.320ms ±0.046 | 0.341ms ±0.036 | 0.364ms | ~1.00x | ≈ | 38.3% | 50 |
| findMany isNot null | 0.250ms ±0.044 | 0.202ms ±0.0030 | 0.231ms | ~1.00x | ≈ | 5.5% | 50 |
| orderBy multi-field | 2.12ms ±0.053 | 0.546ms ±0.018 | 1.11ms | 3.87x 2.03x D | *** | 11.8% | 50 |
| orderBy relation to-one | 1.78ms ±0.044 | 1.48ms ±0.049 | — | ~1.00x | ≈ | 11.9% | 50 |
| orderBy relation + scalar | 1.95ms ±0.081 | 1.55ms ±0.041 | — | ~1.00x | ≈ | 9.6% | 50 |
| orderBy nullable relation | 1.70ms ±0.060 | 1.45ms ±0.121 | — | ~1.00x | ≈ | 30.0% | 50 |
| orderBy deep relation | 2.08ms ±0.042 | 1.83ms ±0.136 | — | ~1.00x | ≈ | 26.8% | 50 |
| orderBy deep relation + scalar | 2.51ms ±0.064 | 2.10ms ±0.040 | — | ~1.00x | ≈ | 7.0% | 50 |
| distinct status | 8.56ms ±0.395 | 1.12ms ±0.032 | — | 7.64x | *** | 10.1% | 50 |
| distinct multi | 11.93ms ±0.138 | 2.55ms ±0.052 | — | 4.68x | *** | 7.4% | 50 |
| cursor composite tuple | 1.60ms ±0.054 | 1.38ms ±0.042 | — | ~1.00x | ≈ | 10.9% | 50 |
| cursor composite desc | 1.70ms ±0.040 | 1.45ms ±0.046 | — | ~1.00x | ≈ | 11.5% | 50 |
| cursor prefix of orderBy | 1.60ms ±0.053 | 1.38ms ±0.074 | — | ~1.00x | ≈ | 19.4% | 50 |
| select + include | 0.653ms ±0.051 | 0.267ms ±0.019 | 0.363ms | ~1.00x | ≈ | 25.0% | 50 |
| _count relation | 0.642ms ±0.041 | 0.588ms ±0.019 | — | ~1.00x | ≈ | 11.4% | 50 |
| _count multi-relation | 0.213ms ±0.027 | 0.201ms ±0.020 | — | ~1.00x | ≈ | 35.5% | 50 |
| _count inside include | 0.986ms ±0.058 | 1.15ms ±0.060 | — | ~1.00x | ≈ | 18.9% | 50 |
| _count inside nested select | 1.49ms ±0.050 | 1.37ms ±0.050 | — | ~1.00x | ≈ | 13.2% | 50 |
| _count deep include | 1.76ms ±0.093 | 1.39ms ±0.053 | — | ~1.00x | ≈ | 13.9% | 50 |
| ILIKE special chars | 0.165ms ±0.021 | 0.179ms ±0.0097 | — | ~1.00x | ≈ | 19.4% | 50 |
| LIKE case sensitive | 0.139ms ±0.017 | 0.156ms ±0.0061 | — | ~1.00x | ≈ | 14.3% | 50 |
| findMany Date range | 1.37ms ±0.047 | 0.529ms ±0.022 | 0.626ms | ~1.00x | ≈ | 15.3% | 50 |
| count Date range | 0.400ms ±0.021 | 0.796ms ±0.218 | 0.424ms | ~1.00x | ≈ | 98.6% | 50 |
| findMany Date gte | 0.182ms ±0.018 | 0.217ms ±0.036 | 0.244ms | ~1.00x | ≈ | 59.4% | 50 |
| depth-1 low-fan | 0.220ms ±0.017 | 0.377ms ±0.097 | — | ~1.00x | ≈ | 92.6% | 50 |
| depth-1 mid-fan | 1.26ms ±0.134 | 1.14ms ±0.243 | — | ~1.00x | ≈ | 77.0% | 50 |
| depth-1 high-fan | 1.12ms ±0.094 | 0.945ms ±0.071 | — | ~1.00x | ≈ | 27.2% | 50 |
| depth-1 wide | 1.02ms ±0.088 | 1.23ms ±0.321 | — | ~1.00x | ≈ | 94.2% | 50 |
| depth-1 unbound | 19.94ms ±0.776 | 9.19ms ±0.233 | — | 2.17x | *** | 9.1% | 50 |
| depth-2 | 2.23ms ±0.326 | 2.02ms ±0.219 | — | ~1.00x | ≈ | 39.1% | 50 |
| depth-2 paginated Project→tasks | 1.06ms ±0.050 | 1.54ms ±0.118 | — | ~1.00x | ≈ | 27.5% | 50 |
| depth-2 high-fan | 1.25ms ±0.077 | 1.23ms ±0.073 | — | ~1.00x | ≈ | 21.5% | 50 |
| depth-2 wide | 1.85ms ±0.394 | 1.35ms ±0.084 | — | ~1.00x | ≈ | 22.4% | 50 |
| depth-2 unbound | 29.91ms ±0.733 | 14.43ms ±0.698 | — | 2.07x | *** | 17.5% | 50 |
| depth-3 unbound | 8.21ms ±0.404 | 6.04ms ±0.407 | — | 1.36x | *** | 24.3% | 50 |
| depth-3 paginated | 1.38ms ±0.056 | 1.74ms ±0.246 | — | ~1.00x | ≈ | 51.0% | 50 |
| depth-4 unbound | 5.09ms ±0.307 | 3.00ms ±0.559 | — | 1.70x | *** | 67.2% | 50 |
| depth-4 paginated | 1.46ms ±0.044 | 1.57ms ±0.233 | — | ~1.00x | ≈ | 53.6% | 50 |
| findFirst depth-2 | 0.933ms ±0.066 | 1.07ms ±0.059 | — | ~1.00x | ≈ | 19.9% | 50 |
| findUnique depth-2 Project→tasks→comment | 0.958ms ±0.042 | 1.02ms ±0.069 | — | ~1.00x | ≈ | 24.4% | 50 |
| complex nested select | 3.33ms ±0.342 | 1.96ms ±0.044 | — | 1.70x | *** | 8.1% | 50 |
| ultra deep query | 12.10ms ±0.144 | 8.15ms ±0.170 | — | 1.48x | *** | 7.5% | 50 |
| transaction: (3 operations) | 12.23ms ±0.158 | 10.51ms ±0.136 | — | 1.16x | *** | 4.7% | 50 |
| परीक्षण | Prisma | prisma-sql | Drizzle | गति वृद्धि | महत्व | CV% | n |
|---|---|---|---|---|---|---|---|
| findMany basic | 0.200ms ±0.044 | 0.057ms ±0.011 | 0.137ms | ~1.00x | ≈ | 67.4% | 50 |
| findMany where = | 0.164ms ±0.024 | 0.078ms ±0.059 | 0.142ms | ~1.00x | ≈ | 270.2% | 50 |
| findMany where >= | 8.34ms ±1.24 | 1.34ms ±0.124 | 2.79ms | 6.23x 2.09x D | *** | 33.5% | 50 |
| findMany where IN | 0.219ms ±0.056 | 0.062ms ±0.022 | 0.199ms | ~1.00x | ≈ | 125.5% | 50 |
| findMany where null | 0.080ms ±0.011 | 0.016ms ±0.0006 | 0.066ms | ~1.00x | ≈ | 15.1% | 50 |
| findMany AND | 0.908ms ±0.094 | 0.510ms ±0.090 | 0.721ms | ~1.00x | ≈ | 63.9% | 50 |
| findMany OR | 4.62ms ±0.257 | 1.25ms ±0.108 | 2.54ms | 3.71x 2.03x D | *** | 31.2% | 50 |
| findMany NOT | 0.188ms ±0.033 | 0.094ms ±0.038 | 0.163ms | ~1.00x | ≈ | 145.6% | 50 |
| findMany orderBy | 2.39ms ±0.156 | 2.10ms ±0.093 | 1.99ms | ~1.00x | ≈ | 16.0% | 50 |
| findMany pagination | 0.083ms ±0.026 | 0.028ms ±0.0019 | 0.062ms | ~1.00x | ≈ | 23.2% | 50 |
| findMany select | 0.134ms ±0.036 | 0.028ms ±0.0033 | 0.084ms | ~1.00x | ≈ | 41.5% | 50 |
| findMany relation some | 0.486ms ±0.049 | 0.478ms ±0.020 | — | ~1.00x | ≈ | 15.3% | 50 |
| findMany relation every | 10.25ms ±0.142 | 8.13ms ±2.17 | — | 1.26x | ns | 96.3% | 50 |
| findMany relation none | 139.06ms ±5.58 | 2.99ms ±0.428 | — | 46.57x | *** | 23.1% | 10 |
| findMany nested relation | 0.426ms ±0.032 | 0.335ms ±0.034 | — | ~1.00x | ≈ | 36.4% | 50 |
| findMany complex | 0.539ms ±0.026 | 0.470ms ±0.021 | 0.531ms | ~1.00x | ≈ | 15.8% | 50 |
| findFirst | 0.117ms ±0.060 | 0.012ms ±0.0003 | 0.078ms | ~1.00x | ≈ | 10.0% | 50 |
| findFirst skip | 0.085ms ±0.0067 | 0.013ms ±0.0003 | 0.075ms | ~1.00x | ≈ | 10.2% | 50 |
| findUnique id | 0.118ms ±0.062 | 0.010ms ±0.0003 | 0.059ms | ~1.00x | ≈ | 7.3% | 50 |
| findUnique email | 0.067ms ±0.0011 | 0.011ms ±0.0003 | 0.051ms | ~1.00x | ≈ | 5.7% | 50 |
| count | 0.041ms ±0.0064 | 0.019ms ±0.012 | 0.016ms | ~1.00x | ≈ | 221.8% | 50 |
| count where | 0.213ms ±0.013 | 0.224ms ±0.014 | 0.181ms | ~1.00x | ≈ | 22.5% | 50 |
| _count via include | 0.458ms ±0.027 | 0.366ms ±0.023 | — | ~1.00x | ≈ | 22.4% | 50 |
| _count via include + relations | 0.894ms ±0.072 | 0.786ms ±0.096 | — | ~1.00x | ≈ | 43.9% | 50 |
| aggregate count | 0.074ms ±0.0008 | 0.016ms ±0.0006 | — | ~1.00x | ≈ | 16.0% | 50 |
| aggregate sum/avg | 0.221ms ±0.012 | 0.245ms ±0.022 | — | ~1.00x | ≈ | 32.9% | 50 |
| aggregate where | 0.226ms ±0.030 | 0.216ms ±0.0030 | — | ~1.00x | ≈ | 5.3% | 50 |
| aggregate min/max | 0.270ms ±0.034 | 0.251ms ±0.017 | — | ~1.00x | ≈ | 24.7% | 50 |
| aggregate complete | 0.302ms ±0.021 | 0.317ms ±0.022 | — | ~1.00x | ≈ | 24.9% | 50 |
| groupBy | 0.524ms ±0.060 | 0.468ms ±0.024 | — | ~1.00x | ≈ | 18.2% | 50 |
| groupBy count | 0.546ms ±0.040 | 0.966ms ±0.344 | — | ~1.00x | ≈ | 128.5% | 50 |
| groupBy multi | 1.31ms ±0.205 | 1.05ms ±0.037 | — | ~1.00x | ≈ | 12.7% | 50 |
| groupBy having | 0.568ms ±0.025 | 0.536ms ±0.022 | — | ~1.00x | ≈ | 14.8% | 50 |
| groupBy + where | 0.262ms ±0.024 | 0.223ms ±0.020 | — | ~1.00x | ≈ | 32.5% | 50 |
| groupBy aggregates | 0.650ms ±0.034 | 0.632ms ±0.061 | — | ~1.00x | ≈ | 34.6% | 50 |
| groupBy min/max | 0.670ms ±0.036 | 0.603ms ±0.025 | — | ~1.00x | ≈ | 14.7% | 50 |
| include posts | 0.968ms ±0.097 | 0.381ms ±0.045 | 1.43ms | ~1.00x | ≈ | 42.7% | 50 |
| include profile | 0.216ms ±0.065 | 0.049ms ±0.0008 | 0.234ms | ~1.00x | ≈ | 6.4% | 50 |
| include 3 levels | 1.32ms ±0.383 | 1.22ms ±0.059 | 0.928ms | ~1.00x | ≈ | 17.4% | 50 |
| include 4 levels | 0.770ms ±0.065 | 1.39ms ±0.072 | 0.695ms | ~1.00x | ≈ | 18.8% | 50 |
| include + where | 0.466ms ±0.054 | 0.273ms ±0.016 | 0.329ms | ~1.00x | ≈ | 21.0% | 50 |
| include + select nested | 0.361ms ±0.021 | 0.273ms ±0.040 | 1.05ms | ~1.00x | ≈ | 52.4% | 50 |
| findMany startsWith | 0.092ms ±0.054 | 0.024ms ±0.0006 | 0.077ms | ~1.00x | ≈ | 7.8% | 50 |
| findMany endsWith | 0.176ms ±0.042 | 0.055ms ±0.0003 | 0.135ms | ~1.00x | ≈ | 2.5% | 50 |
| findMany NOT contains | 0.164ms ±0.017 | 0.070ms ±0.047 | 0.137ms | ~1.00x | ≈ | 238.6% | 50 |
| findMany LIKE | 0.059ms ±0.0019 | 0.025ms ±0.0003 | 0.069ms | ~1.00x | ≈ | 5.2% | 50 |
| findMany < | 8.65ms ±0.553 | 2.23ms ±0.164 | 4.37ms | 3.88x 1.96x D | *** | 26.6% | 50 |
| findMany <= | 9.55ms ±1.17 | 2.73ms ±0.373 | 4.67ms | 3.50x 1.71x D | *** | 49.3% | 50 |
| findMany > | 4.61ms ±0.197 | 1.14ms ±0.081 | 2.35ms | 4.04x 2.06x D | *** | 25.8% | 50 |
| findMany NOT IN | 0.166ms ±0.018 | 0.078ms ±0.042 | 0.124ms | ~1.00x | ≈ | 193.6% | 50 |
| findMany isNot null | 0.171ms ±0.043 | 0.041ms ±0.0008 | 0.101ms | ~1.00x | ≈ | 6.3% | 50 |
| orderBy multi-field | 0.508ms ±0.055 | 0.405ms ±0.023 | 0.457ms | ~1.00x | ≈ | 20.4% | 50 |
| orderBy relation to-one | 0.450ms ±0.065 | 0.708ms ±0.187 | — | ~1.00x | ≈ | 95.3% | 50 |
| orderBy relation + scalar | 0.513ms ±0.028 | 0.403ms ±0.016 | — | ~1.00x | ≈ | 14.0% | 50 |
| orderBy nullable relation | 0.431ms ±0.022 | 0.405ms ±0.063 | — | ~1.00x | ≈ | 56.4% | 50 |
| orderBy deep relation | 0.532ms ±0.063 | 0.373ms ±0.012 | — | ~1.00x | ≈ | 11.9% | 50 |
| orderBy deep relation + scalar | 0.862ms ±0.057 | 1.14ms ±0.269 | — | ~1.00x | ≈ | 85.2% | 50 |
| distinct status | 7.43ms ±0.159 | 4.65ms ±0.047 | — | 1.60x | *** | 3.7% | 50 |
| distinct multi | 7.95ms ±0.154 | 5.64ms ±0.053 | — | 1.41x | *** | 3.4% | 50 |
| select + include | 0.356ms ±0.034 | 0.256ms ±0.015 | 0.154ms | ~1.00x | ≈ | 20.9% | 50 |
| _count relation | 0.432ms ±0.025 | 0.358ms ±0.039 | — | ~1.00x | ≈ | 39.3% | 50 |
| _count multi-relation | 0.100ms ±0.0067 | 0.037ms ±0.0019 | — | ~1.00x | ≈ | 17.7% | 50 |
| _count inside include | 0.704ms ±0.044 | 0.786ms ±0.054 | — | ~1.00x | ≈ | 24.8% | 50 |
| _count inside nested select | 1.29ms ±0.047 | 1.26ms ±0.065 | — | ~1.00x | ≈ | 18.5% | 50 |
| _count deep include | 1.10ms ±0.066 | 1.41ms ±0.060 | — | ~1.00x | ≈ | 15.3% | 50 |
| findMany Date range | 0.129ms ±0.028 | 0.038ms ±0.0006 | 0.346ms | ~1.00x | ≈ | 5.0% | 50 |
| findMany Date gte | 0.093ms ±0.0025 | 0.036ms ±0.0006 | 0.086ms | ~1.00x | ≈ | 4.2% | 50 |
| depth-1 low-fan Project→labels | 0.124ms ±0.0042 | 0.072ms ±0.045 | — | ~1.00x | ≈ | 227.3% | 50 |
| depth-1 mid-fan Project→tasks | 0.904ms ±0.111 | 0.375ms ±0.063 | — | ~1.00x | ≈ | 60.6% | 50 |
| depth-1 high-fan User→assignedTasks | 0.806ms ±0.096 | 0.344ms ±0.058 | — | ~1.00x | ≈ | 61.6% | 50 |
| depth-1 wide | 0.754ms ±0.087 | 0.343ms ±0.049 | — | ~1.00x | ≈ | 51.7% | 50 |
| depth-1 no-limit Project→tasks | 14.01ms ±0.628 | 3.91ms ±0.206 | — | 3.58x | *** | 19.0% | 50 |
| depth-2 | 0.954ms ±0.121 | 0.518ms ±0.087 | — | ~1.00x | ≈ | 60.8% | 50 |
| depth-2 paginated | 0.587ms ±0.046 | 0.400ms ±0.054 | — | ~1.00x | ≈ | 48.5% | 50 |
| depth-2 high-fan | 1.16ms ±0.215 | 0.403ms ±0.042 | — | ~1.00x | ≈ | 38.0% | 50 |
| depth-2 wide+attach+activity | 1.25ms ±0.123 | 0.458ms ±0.049 | — | ~1.00x | ≈ | 38.2% | 50 |
| depth-2 no-limit | 22.98ms ±1.33 | 6.26ms ±0.129 | — | 3.67x | *** | 7.4% | 50 |
| depth-3 | 4.55ms ±0.204 | 1.25ms ±0.088 | — | 3.64x | *** | 25.3% | 50 |
| depth-3 paginated | 0.694ms ±0.055 | 1.26ms ±0.081 | — | ~1.00x | ≈ | 23.1% | 50 |
| depth-4 | 2.82ms ±0.322 | 0.850ms ±0.067 | — | 3.32x | *** | 28.5% | 50 |
| depth-4 paginated | 0.781ms ±0.083 | 1.70ms ±0.255 | — | ~1.00x | ≈ | 54.1% | 50 |
| findFirst depth-2 | 0.592ms ±0.081 | 0.278ms ±0.026 | — | ~1.00x | ≈ | 33.2% | 50 |
| findUnique depth-2 | 0.636ms ±0.083 | 0.270ms ±0.015 | — | ~1.00x | ≈ | 20.0% | 50 |
Prisma की API और types रखते हुए उसकी read execution path को bypass करें
Extension read operations (findMany, findFirst, findUnique, count, aggregate, groupBy) को execute होने से पहले पकड़ता है
Prisma queries को तेज़, parameterized SQL में convert करें, optimized JOINs के साथ
postgres.js या better-sqlite3 के जरिए queries चलाएँ, Prisma read overhead bypass करके
Results Prisma के expected shape से match करते हैं। Types, IntelliSense, और existing query code unchanged रहते हैं
const users = await prisma.user.findMany({
where: { status: 'ACTIVE' },
include: { posts: true }
})
// Direct SQL execution for reads
// Benchmarked around ~1.00ms on this workload
// Same Prisma query code Reads के लिए raw SQL execution speed पाएं और Prisma का developer experience रखें
One-time setup Prisma reads को accelerate करता है। ना refactoring, ना migration, ना downtime।
Full TypeScript support बरकरार। Type inference, autocomplete, और compile-time safety के साथ reads तेज़।
137 E2E tests हाल की Prisma versions के साथ compatibility validate करते हैं। Production apps में Prisma reads accelerate करने के लिए इस्तेमाल।
PostgreSQL (Neon, Supabase सहित) और SQLite पर Prisma reads optimize करें।
Optional generator build-time SQL बनाता है, आपकी hottest queries के लिए overhead को microseconds तक घटाता है।
Serverless Node runtimes में काम करता है। Edge runtime support runtime constraints और आपके driver पर निर्भर है।
Common scenarios जहाँ यह extension real difference बनाता है
Prisma aggregations और groupBy operations को direct SQL execution से बड़ा फायदा मिलता है
Load के तहत per-query overhead बढ़ता है, खासकर read-heavy endpoints पर
Serverless में हर millisecond मायने रखता है: जहाँ ज़रूरी हो वहाँ read latency घटाएँ
Users latency notice करते हैं: तेज़ reads तुरंत perceived UX बेहतर करते हैं
60 seconds से कम में Prisma reads accelerate करें
# PostgreSQL
npm install prisma-sql postgres
# SQLite
npm install prisma-sql better-sqlite3 import { PrismaClient, Prisma } from '@prisma/client'
import { speedExtension, convertDMMFToModels } from 'prisma-sql'
import postgres from 'postgres'
const sql = postgres(process.env.DATABASE_URL)
const models = convertDMMFToModels(Prisma.dmmf.datamodel)
const prisma = new PrismaClient().$extends(
speedExtension({ postgres: sql, models })
) const users = await prisma.user.findMany({
where: { status: 'ACTIVE' },
include: { posts: true }
}) Prisma reads optimize करने के बारे में common सवाल
Prisma overhead जोड़ता है क्योंकि यह schema-based validation, consistent query behavior, और result shaping जैसी API guarantees लागू करता है। ये layers developer experience बढ़ाते हैं, लेकिन raw SQL को सीधे execute करने की तुलना में समय लेते हैं।
Read-heavy Prisma workloads को इस extension जोड़कर optimize करें। यह postgres.js या better-sqlite3 के जरिए reads को direct SQL से execute करता है और Prisma की API व types रखता है। Setup एक छोटा initialization change है और existing queries को refactor करने की जरूरत नहीं होती।
कई read workloads के लिए, हाँ। Raw SQL execution की तुलना में architectural overhead होता है। यह extension Prisma का DX रखते हुए SQL को सीधे execute करके read latency घटाने का लक्ष्य रखता है।
हाँ। Prisma Client initialization के दौरान extension एक बार जोड़ें और अपना existing Prisma query code unchanged रखें। Reads तेज़ चलेंगे जबकि आपकी Prisma API, types और schema वही रहेंगे।
हाँ। यह 137 E2E tests से validated है और production में उपयोग के लिए डिज़ाइन किया गया है। Rollout से पहले अपनी Prisma version के साथ compatibility जरूर verify करें और अपने regression tests चलाएँ।
Aggregations और groupBy अक्सर fixed overhead (query processing और result shaping) को amplify करते हैं और बड़े intermediate result sets involve कर सकते हैं। यह extension SQL सीधे generate करके उन reads को optimize करता है, जिससे aggregation-heavy endpoints पर latency आमतौर पर कम होती है।
Prisma reads optimize करने वाले developers से जुड़ें: 2–7× तेज़ (53.5× तक)