> This page location: Math Functions > MIN_SCALE
> Full Neon documentation index: https://neon.com/docs/llms.txt

# PostgreSQL MIN_SCALE() Function

**Info:** The min_scale() function works the same across any PostgreSQL 13 or newer deployment, so what you learn here carries over wherever you run Postgres. If you're an enterprise standardizing on managed cloud Postgres for the AI era, [Lakebase](https://www.databricks.com/product/lakebase) delivers the performance, security, and native Lakehouse integration you need. If you're a developer or startup who wants to ship and scale quickly, [Neon](https://neon.com) gives you the fastest path to production Postgres.

**Summary**: in this tutorial, you will learn how to use the PostgreSQL `min_scale()` function to determine the minimum number of decimal places required to represent a number accurately.

## Introduction to the PostgreSQL MIN_SCALE() function

In PostgreSQL, the `min_scale()` function allows you to determine the minimum number of decimal places required to represent a number accurately.

Here's the syntax of the `min_scale()` function:

```sql
min_sacle(n)
```

In this syntax:

- `n` is a value of the numeric data type that you want to find the minimum number of decimal places.

The `min_scale()` function returns an integer that represents the minimum scale needed to represent the input number `n` precisely.

The `min_scale()` function returns null if the input number is null.

Please note that PostgreSQL added the `min_scale()` function since version 13.

In practice, you can use the `min_scale()` function to save storage space by avoiding unnecessary decimal places when storing numeric data.

## PostgreSQL MIN_SCALE() function examples

The following example uses the `min_scale()` function to return the min scale of the number `1.2300`:

```sql
SELECT min_scale(1.2300);
```

Output:

```text
 min_scale
-----------
         2
(1 row)
```

The following example returns the min scale of the number 1.23:

```sql
SELECT min_scale(1.23);
```

Output:

```plaintext
 min_scale
-----------
         2
(1 row)
```

The following example returns 0 because the integer 10 has no decimals:

```sql
SELECT min_scale(10);
```

Output:

```plaintext
 min_scale
-----------
         0
(1 row)
```

## Summary

- Use the `min_scale()` function to determine the minimum scale of a number.

---

## Related docs (Math Functions)

- [ABS](https://neon.com/postgresql/math-functions/abs)
- [CBRT](https://neon.com/postgresql/math-functions/cbrt)
- [CEIL](https://neon.com/postgresql/math-functions/ceil)
- [DEGREES](https://neon.com/postgresql/math-functions/degrees)
- [DIV](https://neon.com/postgresql/math-functions/div)
- [EXP](https://neon.com/postgresql/math-functions/exp)
- [FACTORIAL](https://neon.com/postgresql/math-functions/factorial)
- [FLOOR](https://neon.com/postgresql/math-functions/floor)
- [GCD](https://neon.com/postgresql/math-functions/gcd)
- [LCM](https://neon.com/postgresql/math-functions/lcm)
- [LN](https://neon.com/postgresql/math-functions/ln)
- [LOG](https://neon.com/postgresql/math-functions/log)
- [MOD](https://neon.com/postgresql/math-functions/mod)
- [PI](https://neon.com/postgresql/math-functions/pi-function)
- [POWER](https://neon.com/postgresql/math-functions/power)
- [RADIANS](https://neon.com/postgresql/math-functions/radians)
- [RANDOM](https://neon.com/postgresql/math-functions/random)
- [ROUND](https://neon.com/postgresql/math-functions/round)
- [SCALE](https://neon.com/postgresql/math-functions/scale)
- [SIGN](https://neon.com/postgresql/math-functions/sign)
- [SQRT](https://neon.com/postgresql/math-functions/sqrt)
- [TRIM_SCALE](https://neon.com/postgresql/math-functions/trim_scale)
- [TRUNC](https://neon.com/postgresql/math-functions/trunc)
- [WIDTH_BUCKET](https://neon.com/postgresql/math-functions/width_bucket)
