Skip to content

Commit

Permalink
feat: add faq for accelerate transaction billing #DA-935 (#6140)
Browse files Browse the repository at this point in the history
* feat: add faq for accelerate transaction billing behaviour

* Update content/300-accelerate/600-faq.mdx

* fix: add performance incentive

* Update content/300-accelerate/600-faq.mdx
  • Loading branch information
ankur-arch authored Jul 5, 2024
1 parent a163fa4 commit 93b8273
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions content/300-accelerate/600-faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,25 @@ In the rare event of a service disruption, falling back to a direct connection w
If there is a service disruption, it's recommended to verify on the [status page](https://pris.ly/data-platform-status). You can reach out to one of Prisma's [support channels](/platform/support) for assistance.

> **Note:** Additionally, it's worth noting that some edge function runtime environments may not support direct connections with Prisma ORM. For further details, refer to our [Edge functions documentation](/orm/prisma-client/deployment/edge/overview).
## Are each of the queries within an interactive transaction counted separately for billing?

Yes, [interactive transactions](/orm/prisma-client/queries/transactions#interactive-transactions) are billed based on the individual operations within the transaction. There is no charge for the start, commit, or rollback of the transaction itself. For example, in the following query, there are two billable queries:

```ts
await prisma.$transaction(async (tx) => {
await tx.user.deleteMany({ where: { name: 'John Doe' } });
await tx.user.createMany({ data });
});
```

However, when using the [`$transaction` API for sequential client operations](/orm/prisma-client/queries/transactions#sequential-prisma-client-operations), regardless of the number of queries within the array, it counts as only one billable query. For example:

```ts
await prisma.$transaction([
prisma.user.deleteMany({ where: { name: 'John Doe' } }),
prisma.user.createMany({ data }),
]);
```

If you don't need [interactive transactions](/orm/prisma-client/queries/transactions#interactive-transactions), you can save costs and improve performance by using [sequential operations transactions](/orm/prisma-client/queries/transactions#sequential-prisma-client-operations). Sequential operations transactions perform better on Accelerate because they execute in one round-trip to the database, while interactive transactions require separate round-trips for start, commit, and each individual operation on the transaction.

0 comments on commit 93b8273

Please sign in to comment.