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

# Connection Profiling

> Deep-inspect any connection to discover tables, measure performance, and get optimization tips before you sync.

**Connection Profiling** lets you run a read-only diagnostic on any connection directly from the Zwiron dashboard. The agent connects to your database, inspects it top-to-bottom, and returns a full report — without creating a pipeline or touching any data.

***

## What profiling measures

| Section              | What you get                                                                            |
| -------------------- | --------------------------------------------------------------------------------------- |
| **Server version**   | Database version string (e.g. PostgreSQL 16.2, MySQL 8.0.35)                            |
| **Infrastructure**   | CPU count, memory, max connections, current connections                                 |
| **Network**          | Connect time (ms), round-trip latency (ms) from agent to database                       |
| **Tables**           | Per-table: row count, size on disk, last modified                                       |
| **Totals**           | Total rows and total size across all tables                                             |
| **Capabilities**     | What features are available: CDC (logical replication), bulk load, upsert support, etc. |
| **Optimizations**    | Specific recommendations — missing indexes, sub-optimal settings                        |
| **Read strategies**  | Which read strategies are available given the detected capabilities                     |
| **Write strategies** | Which write strategies are available for use as a destination                           |

***

## How to run a profile

1. Go to **Connections** → select a connection → **Profile**
2. Zwiron sends a profile request to the agent that owns the connection
3. The agent connects read-only, gathers all the data, and returns it
4. You see the full profile report in the dashboard

Profiling has a 55-second timeout. Large databases with many tables may take longer to gather metadata — Zwiron collects what it can within the window.

***

## Profiling and pipeline creation

When you create a new pipeline, Zwiron automatically runs a lightweight profile in the background to:

* Auto-discover tables (so you can check/uncheck them)
* Detect which sync modes are available (CDC requires specific capabilities)
* Suggest the best read and write strategies for your database configuration

The profile runs through your agent — it never hits your database from Zwiron's cloud directly.

***

## Capabilities

The profiling report shows a **Capabilities** section — a checklist of features Zwiron detected (or didn't detect) in your database. Examples:

| Capability            | What it means                                              |
| --------------------- | ---------------------------------------------------------- |
| `logical_replication` | CDC via logical replication is available (PostgreSQL)      |
| `binlog`              | CDC via binary log is available (MySQL)                    |
| `bulk_insert`         | Destination supports bulk loading (faster than row-by-row) |
| `upsert`              | Destination supports INSERT ON CONFLICT (native upsert)    |
| `copy_protocol`       | PostgreSQL COPY protocol available for bulk reads          |
| `merge_statement`     | SQL MERGE available for upsert writes                      |

***

## Optimizations

For every missing capability that Zwiron recommends enabling, the profile report includes an **Optimization** entry with:

* What to change
* Why it matters for performance
* The exact SQL or configuration needed

Example:

```
Optimization: Enable logical replication
Why: Allows CDC (real-time change capture) for this connection.
Fix:
  ALTER SYSTEM SET wal_level = logical;
  SELECT pg_reload_conf();
```

***

## Read and write strategies

Based on detected capabilities, the profile lists which strategies are available:

**Read strategies** (source):

* Full scan
* Keyset pagination (fast for large tables with an indexed cursor)
* COPY protocol (PostgreSQL only — maximum throughput)
* Parallel partition read (split by range or hash)

**Write strategies** (destination):

* Row-by-row INSERT
* Bulk INSERT (batch)
* COPY protocol (PostgreSQL)
* INSERT ON CONFLICT (upsert)
* MERGE statement

Zwiron automatically selects the best available strategy when creating a pipeline. You can also override it in advanced settings.

***

## Security

Profiling is **read-only**. The agent uses `SELECT` and system catalog queries only — it never writes to or modifies your database during a profile run. The profile result is transmitted over the existing TLS-secured agent connection.
