> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fabi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# PostgreSQL

> Connecting Fabi.ai to your [PostgreSQL](https://www.postgresql.org/) instance.

<Warning>
  Before connecting, ensure that you whitelist Fabi.ai's IP addresses in your firewall or security group settings:

  * `3.232.60.87`
  * `54.172.255.171`
</Warning>

# Creating a service account user

## 1. Access PostgreSQL

Open your PostgreSQL client or connect to the database server using the `psql` command-line tool:

```bash theme={null}
psql -U postgres
```

## 2. Create the service user

Use the `CREATE USER` command to define the user and assign a secure password:

```sql theme={null}
CREATE USER service_user WITH PASSWORD 'secure_password';
```

* Replace `service_user` with your desired username.
* Replace `secure_password` with a strong password.

## 3. Grant necessary privileges

Fabi.ai needs read access to the schemas that you wish to query.

To grant the ability to connect to a database:

```sql theme={null}
GRANT CONNECT ON DATABASE your_database TO service_user;
```

To give access to specific schemas:

```sql theme={null}
GRANT USAGE ON SCHEMA your_schema TO service_user;
```

To allow the user to read from tables:

```sql theme={null}
GRANT SELECT ON ALL TABLES IN SCHEMA your_schema TO service_user;
```

Optional: To automatically grant privileges on new tables:

```sql theme={null}
ALTER DEFAULT PRIVILEGES IN SCHEMA your_schema GRANT SELECT ON TABLES TO service_user;
```

[PostgreSQL Documentation: Privileges](https://www.postgresql.org/docs/current/ddl-priv.html)

# Connecting PostgreSQK to Fabi.ai

Once you've generated your service user credentials, follow the steps in [Connecting to Your Data](/getting_started/connect_data_sources)
<Tip>For information about our industry-leading security practices, check out our [Security hub](https://www.fabi.ai/security).</Tip>

# Hydra

For organizations that use PostgreSQL, we've partnered with [Hydra](https://www.hydra.so/) to provide real-time analytics on transactional databases.

Hydra is a high-performance database system that leverages DuckDB to combine transactional and analytical capabilities in one platform. It streamlines real-time analytics on live transactions and events by eliminating the need for data movement and transformation (ETL) between the transactional rowstore and the analytical columnstore.

Combining Hydra and Fabi.ai creates a powerful analytical experience leveraging AI directly on transactional databases withour compromising latency or uptime.
