---
title: "pg_stat_statements extension"
url: "https://docs.yugabyte.com/stable/additional-features/pg-extensions/extension-pgstatstatements/"
---

# pg_stat_statements extension

Using the pg_stat_statements extension in YugabyteDB

The [pg\_stat\_statements](https://www.postgresql.org/docs/15/pgstatstatements.html "pg_stat_statements") module provides a means for tracking execution statistics of all SQL statements executed by a server.

```sql
CREATE EXTENSION pg_stat_statements;

SELECT query, calls, total_time, min_time, max_time, mean_time, stddev_time, rows FROM pg_stat_statements;
```

To get the output of `pg_stat_statements` in JSON format, visit `https://<yb-tserver-ip>:13000/statements` in your web browser, where `<yb-tserver-ip>` is the IP address of any YB-TServer node in your cluster.

For more information on using pg\_stat\_statements in YugabyteDB, refer to [Get query statistics using pg\_stat\_statements](/stable/launch-and-manage/monitor-and-alert/query-tuning/pg-stat-statements/ "Get query statistics using pg_stat_statements").
