Recommendations
Query Pattern
Query patterns are used to group similar queries together and analyze their performance.
await prisma.product.findMany({ where: { quantity: ? } });
Schema Recommendations
For your Product model, considering you often query products based on their quantity, I recommend adding a non-unique index to the quantity field. This change should improve the performance of these queries while allowing multiple products to have the same quantity value.
Proposed Schema
model Product {
id Int @id @default(autoincrement())
name String
description String?
price Float
- quantity Int
+ quantity Int @index
categoryId Int
category Category @relation(fields: [categoryId], references: [id])
orderItems OrderItem[]
createdAt DateTime @default(now()) // For newProductsLastMonth query
}
Performance
Metrics
These are your key database performance metrics in the selected time range.
Average total duration
63.94msAVG
65msP50
73.4msP99
73.6msMAX
Queries per second
43.70-1%
vs. prior 7 days
Error rate
0.050%-1%
vs. prior 7 days
Overall status
Regression
vs. prior 7 days
Latencies
The following graph shows the time it takes for prisma queries to complete
Errors
The following graph shows the query failures and successes over time.