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

# PostgreSQL MIN_SCALE() Function

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