> For the complete documentation index, see [llms.txt](https://docs.subsalt.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.subsalt.io/retrieving-data/running-queries.md).

# Running queries

Once a synthetic database has been built, it can be queried just like any other Postgres database, which means the same tools used to connect to other Postgres databases can be used to connect to Subsalt synthetic databases.

### Connecting to Subsalt's query endpoint

You can find connection details on the **Profile > Connection details** page in the Subsalt portal; these details won't change unless you modify your password and can be stored in your Postgres client.

{% hint style="info" %}
If you don't have a preferred client, we recommend [TablePlus](https://tableplus.com/) as a graphical application, [psql](https://www.postgresql.org/docs/current/app-psql.html) for command-line access, and [psycopg2](https://docs.subsalt.io/) for Python access.

Additionally, you can execute queries directly in the Subsalt portal by navigating to the **Query** tab for the database you want to query. Results are limited to 1000 rows of data.
{% endhint %}

For users associated with SSO-based organizations, you'll need to set a Subsalt-specific password to be able to connect - *do not use the password associated with your identity provider*.

{% hint style="info" %}
Working with an AI agent? Subsalt also exposes a **Model Context Protocol (MCP)** server that lets agents explore schemas, query synthetic data, and compute de-identified answers on real data over a single authenticated connection. See the MCP documentation.
{% endhint %}

### Data quality

You can retrieve a detailed quality assessment for the results for any query from the Subsalt portal; read more about what information is available and how to access it in [Data quality](/retrieving-data/data-quality.md).

#### `__rare__`

You may notice the value `__rare__` appearing in your data when the value was not present in the source table. This is an automatic mask to any categorical field that has a very low occurrence rate, and is used to automatically reduce long-tail privacy risk.&#x20;

If your column is part of your schema as a numeric field whose context is set as categorical, this `__rare__` value will appear as `-9999999` to ensure that your schema type is consistent with the source.

### Supported SQL features

Subsalt supports the PostgreSQL dialect of SQL, and you should use this dialect regardless of the source system's native dialect.

The Subsalt query interface is *read only* and only supported `SELECT` queries; writes and updates are not allowed and must be applied to the original data source.

Subsalt currently supports inner joins, but does not support other join types (left joins, outer joins, etc).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.subsalt.io/retrieving-data/running-queries.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
