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

# Federated Analytics

> Query and join data across multiple databases without ETL

<Info>
  Federated Analytics in SyneHQ lets you run a single SQL query across multiple databases and file sources—no data movement required. It’s powered by Tangent Lake (DuckDB under the hood) and works with your existing connections.
</Info>

## Why federated analytics?

* **One query, many sources**: Join Postgres, MySQL, SQLite, DuckDB files, even CSV/JSON
* **Zero ETL**: Analyze live data without pipelines
* **Faster iteration**: Explore, validate, and answer questions quickly
* **Governed access**: Uses SyneHQ connections, RBAC, and auditing

## Get started in minutes

<CardGroup cols={3}>
  <Card title="Create a Tangent" icon="rocket" href="/features/tangent-lake/getting-started">
    Build a federated workspace using your existing connections
  </Card>

  <Card title="How it works" icon="server" href="/features/tangent-lake/how-it-works">
    DuckDB ATTACH, planning, and orchestration explained
  </Card>

  <Card title="SQL examples" icon="code" href="/features/tangent-lake/examples">
    Copy‑paste queries for cross‑database joins and metrics
  </Card>
</CardGroup>

## Example: Postgres + MySQL

```sql theme={"system"}
SELECT u.id, u.name, SUM(o.amount) AS revenue
FROM postgres_db.public.users u
JOIN mysql_db.sales.orders o ON u.id = o.user_id
GROUP BY u.id, u.name
ORDER BY revenue DESC
LIMIT 10;
```

<Note>
  This runs live—DuckDB fetches only the data needed and performs the join. No exports or imports.
</Note>

## Common patterns

<AccordionGroup>
  <Accordion title="Time-windowed KPIs">
    ```sql theme={"system"}
    SELECT DATE_TRUNC('month', o.created_at) AS month, SUM(o.amount) AS revenue
    FROM mysql_db.sales.orders o
    GROUP BY month
    ORDER BY month;
    ```
  </Accordion>

  <Accordion title="Blend CSV/JSON with a database">
    ```sql theme={"system"}
    SELECT u.email, c.last_login
    FROM postgres_db.public.users u
    JOIN read_csv_auto('https://example.com/logins.csv') c
      ON u.email = c.email;
    ```
  </Accordion>

  <Accordion title="Materialize a working set">
    ```sql theme={"system"}
    CREATE TABLE top_customers AS
    SELECT u.id, u.name, SUM(o.amount) AS revenue
    FROM postgres_db.public.users u
    JOIN mysql_db.sales.orders o ON u.id = o.user_id
    GROUP BY u.id, u.name
    ORDER BY revenue DESC
    LIMIT 100;
    ```
  </Accordion>
</AccordionGroup>

## How it works (at a glance)

* **Tangent session**: Selected connections are attached into a DuckDB session
* **Federated planning**: Filters and projections are pushed down to sources
* **Minimal movement**: Only necessary data is pulled to complete the query
* **Extensible**: Supports Postgres, MySQL, SQLite, files (CSV/JSON/Parquet), and more

<CardGroup cols={2}>
  <Card title="Tangent Lake Overview" icon="database" href="/features/tangent-lake/overview">
    The federated query lake behind Federated Analytics
  </Card>

  <Card title="Local connections" icon="bridge" href="/features/local-connections">
    Query private/on‑prem data with a secure tunnel
  </Card>
</CardGroup>

## Tips

* Start with smaller result sets; expand once logic is correct
* Use explicit aliases for clarity across engines (e.g., `pg_`, `mysql_`)
* Materialize intermediate results only when needed (for repeat jobs)
* Monitor source credentials and permissions (least‑privilege recommended)

<Info>
  Federated Analytics is available in SaaS and enterprise self‑hosted. For large/regulated environments, contact us for sizing and rollout guidance.
</Info>
