You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a32879b
Browse filesBrowse the repository at this point in the historyBrowse files
docs, blog, site: bill Prisma Postgres operations per SQL statement (#8994)
* docs, blog, site: bill Prisma Postgres operations per SQL statement
Several pages still used the Prisma Accelerate rule that one Prisma ORM
query is one operation. Prisma Postgres counts one operation per SQL
statement sent to the database (each Query or Execute message at the
proxy), for every client and for pooled and direct connections alike.
BEGIN, COMMIT, ROLLBACK, failed statements and set_config calls count;
opening a connection and Parse, Bind and Sync are free.
- Postgres FAQ: rewrite "What is an operation?" and the ORM vs direct
connection answer in SQL statement terms, add a pg.Pool note, and
rewrite the cost tips with the Prisma ORM 8 API. A transaction with two
creates is 4 operations and one with three inserts is 5, not 2 and 1.
- Blog, operations-based-billing: the example query is billed as the 10
statements it sends, not as one operation.
- Blog, prisma-postgres-vs-neon-pricing-2026: worked examples count SQL
statements per request instead of ORM queries; figures unchanged.
- Blog, serverless-postgres: billing summary uses the statement rule.
- Site pricing FAQ, calculator hint and llms pricing data: same rule.
Supersedes the FAQ change in #8951.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* blog, site: state the trace's assumptions and count transaction statements
- operations-based-billing: say the example query is written for Prisma
ORM 6 and that its 10-statement trace assumes neither post exists, so
connectOrCreate creates both.
- pricing-data: the "How is Prisma's pricing different" answer counts
every SQL statement, including BEGIN and COMMIT, not only statements
that create, read, update or delete records.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: apps/blog/content/blog/operations-based-billing/index.mdx
+12-5Lines changed: 12 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
title: "Operations-Based Billing: A Simpler Pricing Model for Modern Databases"
3
3
slug: "operations-based-billing"
4
4
date: "2025-05-15"
5
+
updatedAt: "2026-12-01"
5
6
authors:
6
7
- "Petra Donka"
7
8
metaTitle: "Operations-Based Billing: A Simpler Pricing Model for Modern Databases"
@@ -24,13 +25,13 @@ Let’s dive into how operations-based pricing works and how to calculate your c
24
25
25
26
### What is an operation?
26
27
27
-
At it’s core, an operation is an action you perform against your Prisma Postgres database, whether that’s a create, a read, an update or a delete, or even a cached read.
28
+
At its core, an operation is one SQL statement sent to your Prisma Postgres database, whether that statement is a create, a read, an update or a delete.
28
29
29
-
We count these as the [queries](https://www.prisma.io/docs/orm/fundamentals/reading-data) you issue via the Prisma ORM (a “Prisma Query” for short), as the Prisma ORM is the primary client you use to interact with your database. This is similar to how other database providers provide their own clients, though the Prisma ORM goes a few steps further with a superior, type-safe developer experience and additional features, like migrations, to simplify working with your database. In short, it’s a big part of what gives you a great DX when working with Prisma Postgres, and every query you run through it counts as an operation.
30
+
We count operations at the proxy in front of the database, so the rule is the same for every client: [Prisma ORM](https://www.prisma.io/docs/orm/fundamentals/reading-data), Drizzle, `pg` or `psql`, over a pooled or a direct connection. `BEGIN`, `COMMIT`and `ROLLBACK` are statements too, so each one counts as an operation, and so does a statement that fails. Opening a connection is free, and so are the Parse, Bind and Sync steps of the PostgreSQL protocol.
30
31
31
-
The reason we chose this approach is because it’s so simple. Behind the scenes, a complex Prisma Query may result in multiple SQL statements, but for billing purposes, it remains one operation, so you never have to think about it. A simple create and a complex read with multiple JOINs may also take different durations to complete, but that’s another thing you don’t have to reason about, nor the data transfer bandwidth they use.
32
+
The reason we chose this approach is because it’s so simple. A simple insert and a complex read with multiple JOINs may take different durations to complete, but each is one statement, so each is one operation. That’s another thing you don’t have to reason about, nor the data transfer bandwidth they use.
32
33
33
-
Let’s take a look at a single operation through an example. The following Prisma Query is billed as one operation, yet it translates to several (8, in the case of the example below) SQL statements.
34
+
One thing to keep in mind: a single ORM query can send more than one SQL statement, and each statement counts. Let’s look at an example. The following Prisma Client query, written for Prisma ORM 6 (the current version when this post was first published), sends 10 SQL statements, including `BEGIN` and `COMMIT`, so it’s billed as 10 operations. The trace below assumes neither post exists yet, so `connectOrCreate` creates both. When a post already exists, it is linked instead of created, and the statement count changes with it.
34
35
35
36
36
37
@@ -85,14 +86,16 @@ WHERE t0."id"=$1 LIMIT $2; -- fetch user
85
86
COMMIT; -- commit transaction
86
87
```
87
88
89
+
Counting the statements above gives 10 operations: `BEGIN`, eight statements that read and write the data, and `COMMIT`.
90
+
88
91
89
92
### Why is an operations-based pricing model better?
90
93
91
94
In practice, this shifts your mental model, and we think it does so in a good way. Instead of asking *“How much compute time will this endpoint use?”* or *“What if this launch creates traffic that maxes out the CPU or RAM we have?”*, you ask, *“How many operations will this user interaction generate?”* It’s easier to reason about, easier to predict, and keeps your team focused on product behavior, not infra behavior.
92
95
93
96
Basing pricing on operations means:
94
97
95
-
- You don't have to spend hours thinking about the compute required for your database operation, whether it’s a simple write to the database, or a complex query involving multiple JOINs, it’s just one operation.
98
+
- You don't have to spend hours thinking about the compute required for your database operation, whether it’s a simple write to the database, or a complex query involving multiple JOINs, one statement is just one operation.
96
99
- You don’t pay more for write-heavy workloads, writes and reads are simply billed equally.
97
100
- Data transfer has no impact on your bill, so queries with small or large egress cost the same.
98
101
- Cached queries simply count as operations and also benefit from much lower latency and predictable pricing.
@@ -130,3 +133,7 @@ We hope this explanation is helpful for you in clarifying any questions you may
130
133
An app's customer credits are a different measure from database operations. The [AI usage-credit hosting guide](https://www.prisma.io/compute/ai-usage-credits) covers saved request identifiers, balance reservations and settlement alongside infrastructure costs.
131
134
132
135
In the meantime, [give Prisma Postgres a try](http://console.prisma.io), we can’t wait to see what you build with it!
136
+
137
+
## Update history
138
+
139
+
- 2026-12-01: "What is an operation?" now describes operations as SQL statements: Prisma Postgres bills one operation per statement sent to the database, for every client and for pooled and direct connections alike. `BEGIN`, `COMMIT`, `ROLLBACK` and failed statements count too. The example query is now billed as the 10 statements it sends instead of as one operation. The earlier rule, one Prisma ORM query as one operation, came from Prisma Accelerate and does not apply to Prisma Postgres.
0 commit comments