Skip to content

Commit

Permalink
Merge branch 'main' into ankur-arch-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
ankur-arch authored Dec 12, 2024
2 parents d729781 + 8439c2b commit e86c309
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions content/200-orm/500-reference/375-supported-databases.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ An asterisk (\*) indicates that the version number is not relevant; either all v
| PostgreSQL | 14 |
| PostgreSQL | 15 |
| PostgreSQL | 16 |
| PostgreSQL | 17 |
| SQLite | \* |

Note that a fixed version of SQLite is shipped with every Prisma ORM release.
Expand Down
2 changes: 1 addition & 1 deletion content/200-orm/500-reference/380-connection-urls.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The connection URL is provided via the `url` field of a `datasource` block in yo
- **Port**: The port on which your database server is running
- **Database name**: The name of the database you want to use

Make sure you have this information at hand when getting started with Prisma ORM. If you don't have a database server running yet, you can either use a local SQLite database file (see the [Quickstart](/getting-started/quickstart-sqlite)) or [setup a free PostgreSQL database on Supabase](https://dev.to/prisma/set-up-a-free-postgresql-database-on-supabase-to-use-with-prisma-3pk6).
Make sure you have this information at hand when getting started with Prisma ORM. If you don't have a database server running yet, you can either use a local SQLite database file (see the [Quickstart](/getting-started/quickstart-sqlite)) or [setup a free PostgreSQL database with Prisma Postgres](/orm/overview/databases/prisma-postgres).

</TopBlock>

Expand Down
1 change: 1 addition & 0 deletions content/700-optimize/300-recordings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ When a recording session ends, Optimize generates recommendations such as:
- [Queries on unindexed columns](/optimize/recommendations/queries-on-unindexed-columns)
- [Repeated query](/optimize/recommendations/repeated-query)
- [Overfetching](/optimize/recommendations/select-returning)
- [Using `@db.Money`](/optimize/recommendations/avoid-db-money)

:::info
Use [Prisma AI](/optimize/prisma-ai) to ask follow-up questions about a recommendation.
Expand Down
28 changes: 28 additions & 0 deletions content/700-optimize/400-recommendations/600-avoid-db-money.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: 'Using @db.Money'
metaTitle: 'Optimize Recommendations: Avoid usage of `@db.Money`'
metaDescription: "Learn about the recommendation provided by Optimize for using `@db.Money` native type."
tocDepth: 3
toc: true
---

Optimize provides recommendations to help you identify and resolve performance issues caused by the use of `@db.Money` type.

The following model uses the `@db.Money` native type:

```prisma
model Item {
// ...
price Decimal @db.Money
// ...
}
```

## What is the problem?

The `@db.Money` data type in PostgreSQL is not ideal for storing monetary values. Internally, `@db.Money` is implemented as an integer, which offers speed but lacks flexibility. It handles fractional values and rounding in unexpected ways, which can lead to inaccuracies.

Additionally, the `@db.Money` type does not store any information about the associated currency. Instead, it relies on the global `lc_monetary` locale setting, which may not be suitable for all use cases.

For more information, refer to the [PostgreSQL documentation](https://wiki.postgresql.org/wiki/Don't_Do_This#Don.27t_use_money).

0 comments on commit e86c309

Please sign in to comment.