Skip to content

Commit

Permalink
feat: add faq for accelerate transaction billing behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
ankur-arch committed Jul 3, 2024
1 parent a163fa4 commit 35a1dfe
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions content/300-accelerate/600-faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,27 @@ 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).
Sure! Here's the revised FAQ item:

## 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 the additional functionality of [interactive transactions](/orm/prisma-client/queries/transactions#interactive-transactions), you can save costs by relying on [array-based transactions](/orm/prisma-client/queries/transactions#sequential-prisma-client-operations) instead.

0 comments on commit 35a1dfe

Please sign in to comment.