## Troubleshooting: `pg_stat_statements` Relation Does Not Exist
**Issue**
When running a query through OpenMetadata, you may encounter the following error:
```sql
(psycopg2.errors.UndefinedTable) relation "pg_stat_statements" does not exist
LINE 9: pg_stat_statements s
```
**Cause**
This error occurs because the PostgreSQL extension `pg_stat_statements` is not enabled. This extension is required to access query execution statistics, which are used by OpenMetadata for usage and performance insights.
**Solution**
Enable the `pg_stat_statements` extension in your PostgreSQL instance. You can do this by executing the following command as a superuser:
```sql
CREATE EXTENSION pg_stat_statements;
```
Additionally, ensure the extension is loaded at server startup by setting the following in your `postgresql.conf`:
```sql
shared_preload_libraries = 'pg_stat_statements'
```
After making this change, restart the PostgreSQL server.
For more details, refer to the official PostgreSQL documentation: [pg_stat_statements – PostgreSQL](https://www.postgresql.org/docs/current/pgstatstatements.html)
Note that we only support officially supported PostgreSQL versions. You can check the version list [here](https://www.postgresql.org/support/versioning/).
When trying to connect to a PostgreSQL server hosted on Azure/AWS using basic authentication, the connection may fail with the following error message:
```
(psycopg2.OperationalError) FATAL: no pg_hba.conf entry for host "x.xx.xxx.x", user "xxxxxx", database "xxxxx", no encryption
This error generally indicates that the host trying to access the PostgreSQL server is not permitted according to the server's `pg_hba.conf` configuration, which manages authentication.
Ensure that the IP address provided by the OpenMetadata Service wizard is whitelisted in the Azure network firewall rules. You should also verify that the correct IP is added in the firewall for the database to allow connections from OpenMetadata.
2.**Check pg_hba.conf File**
While Azure-managed PostgreSQL doesn't allow direct access to modify the `pg_hba.conf` file, you can control access using Azure Firewall rules. Ensure that the IP address attempting to connect is allowed.
3.**Verify Network Access**
Ensure that the PostgreSQL server is accessible from the internet for the allowed IP addresses. If the server is behind a VPN or private network, adjust the network settings accordingly.
4.**Adjust SSL Mode**
The error could also be related to SSL settings. Setting the SSL mode to `allow` can help resolve this issue. Modify the connection settings in the OpenMetadata Service configuration to:
```
SSL Mode: Allow
```
This will allow the connection even if SSL is not enforced by the server.