Skip to content
1 change: 1 addition & 0 deletions TOC-tidb-cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@
- [Sequence Functions](/functions-and-operators/sequence-functions.md)
- [List of Expressions for Pushdown](/functions-and-operators/expressions-pushed-down.md)
- [TiDB Specific Functions](/functions-and-operators/tidb-functions.md)
- [Utility Functions](/functions-and-operators/utility-functions.md)
- [Clustered Indexes](/clustered-indexes.md)
- [Constraints](/constraints.md)
- [Generated Columns](/generated-columns.md)
Expand Down
1 change: 1 addition & 0 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,7 @@
- [Sequence Functions](/functions-and-operators/sequence-functions.md)
- [List of Expressions for Pushdown](/functions-and-operators/expressions-pushed-down.md)
- [TiDB Specific Functions](/functions-and-operators/tidb-functions.md)
- [Utility Functions](/functions-and-operators/utility-functions.md)
- [Comparisons between Functions and Syntax of Oracle and TiDB](/oracle-functions-to-tidb.md)
- [Clustered Indexes](/clustered-indexes.md)
- [Vector Index](/vector-search/vector-search-index.md)
Expand Down
42 changes: 42 additions & 0 deletions functions-and-operators/utility-functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: Utility Functions
summary: This document introduces utility functions supported in TiDB.
---

# Utility Functions

This document introduces utility functions supported in TiDB
Comment thread
hfxsd marked this conversation as resolved.
Outdated

Comment thread
dveeden marked this conversation as resolved.
## `FORMAT_BYTES()`

The `FORMAT_BYTES()` function formats a number of bytes into a human-readable format for you.
Comment thread
hfxsd marked this conversation as resolved.
Outdated

```sql
SELECT FORMAT_BYTES(10*1024*1024);
```
Comment thread
hfxsd marked this conversation as resolved.

```
+----------------------------+
| FORMAT_BYTES(10*1024*1024) |
+----------------------------+
| 10.00 MiB |
+----------------------------+
1 row in set (0.001 sec)
Comment thread
hfxsd marked this conversation as resolved.
```

## `FORMAT_NANO_TIME()`

The `FORMAT_NANO_TIME()` function formats a number of nanoseconds as a human-readable number.
Comment thread
hfxsd marked this conversation as resolved.
Outdated

```sql
SELECT FORMAT_NANO_TIME(1000000);
```
Comment thread
hfxsd marked this conversation as resolved.

```
+---------------------------+
| FORMAT_NANO_TIME(1000000) |
+---------------------------+
| 1.00 ms |
+---------------------------+
1 row in set (0.001 sec)
Comment thread
hfxsd marked this conversation as resolved.
```