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

> ## Agent Instructions
> PawSQL 是一个产品：Cloud 是公网部署形态，Engine / Optimizer / Auditor / Advisor / Patroller 是同一产品的组件与交付形态，不是彼此独立的产品。 / PawSQL is a single product: Cloud is the public deployment form, while Engine / Optimizer / Auditor / Advisor / Patroller are components and delivery forms of the same product, not separate products.
> 术语以站内术语表为准：SQL 审核对应英文 SQL Review，查询重写对应 Query Rewrite，索引推荐对应 Index Recommendation；英文内容统一用 Review，不用 Audit。 / Use the site glossary for terminology: 审核 is SQL Review, 重写 is Query Rewrite, 索引推荐 is Index Recommendation; English content uses Review, never Audit.
> 引用能力范围或版本支持时以对应页面为准；标注 unknown、或 status 非 published 的内容表示尚未经产品核实，不应作为事实引用。 / Cite capability scope and version support from the corresponding page; content marked unknown, or with a status other than published, is not yet product-verified and must not be cited as fact.

# Create a Workspace from a Database

> Connect PawSQL to a database and synchronize the authorized schemas, tables, columns, constraints, and indexes.

A connected workspace retrieves metadata from the target database through a dedicated account. This approach is designed for recurring team use, evolving schemas, production query governance, and features that depend on plans or runtime information.

## Goal

Connect PawSQL to a database and synchronize the authorized schemas, tables, columns, constraints, and indexes into a workspace.

## Prerequisites

A connected workspace requires:

* Network reachability from the PawSQL service to the database;
* a database and version supported by the PawSQL release;
* a dedicated database account;
* an approved database or schema scope;
* known TLS, allowlist, proxy, and connection-limit requirements;
* permission to create both workspaces and connections.

## Apply least privilege

| Required capability            | Permission approach                                           |
| ------------------------------ | ------------------------------------------------------------- |
| Read schema and index metadata | Grant only the catalog access required for the selected scope |
| Retrieve execution plans       | Add the minimum plan privilege required by that database      |
| Run online validation          | Permit only in an isolated, approved environment              |
| Collect patrol data            | Restrict access to approved instances and performance views   |

<Warning>
  Do not use a database administrator account or reuse an application account. A failed metadata read is not a reason to grant unrestricted privileges.
</Warning>

## Connection inputs

Typical inputs include connection name, engine and version, host, port, database or service identifier, username, secret, TLS configuration, optional driver properties, and schema scope. Exact fields vary by database and PawSQL release.

## Create the workspace

With the database connection as the source, create the workspace in these steps:

<Steps>
  <Step title="Create a workspace">Open workspace management in the correct organization or project, then enter a name and purpose.</Step>
  <Step title="Select engine and version">Match the real database deployment.</Step>
  <Step title="Choose database connection">Create a connection or select an approved shared connection.</Step>
  <Step title="Enter connectivity settings">Provide endpoint, identity, and security parameters.</Step>
  <Step title="Test the connection">Validate network, TLS, authentication, and basic catalog access.</Step>
  <Step title="Limit synchronization scope">Select only the databases or schemas required by the project.</Step>
  <Step title="Synchronize and review">Inspect created, updated, skipped, and failed objects.</Step>
</Steps>

## Scope guidance

A focused schema scope reduces synchronization time, limits metadata exposure, and makes object selection easier. Include multiple schemas only when the target SQL genuinely crosses those boundaries.

## Expected Result

After synchronization completes, the workspace contains the authorized schemas, tables, columns, constraints, and indexes, ready for SQL review and optimization.

## Verification

Confirm the workspace was created correctly by checking that the target schema is visible, tables, columns, and indexes can be read, the database version is recognized, and metadata synchronization completed without widespread failures.

## Troubleshooting

| Symptom                | Check first                                                      |
| ---------------------- | ---------------------------------------------------------------- |
| Connection timeout     | Network path from PawSQL, DNS, routing, firewall, allowlist      |
| Authentication failure | Username, secret, database identifier, account status            |
| TLS error              | Certificate validity, hostname, trust chain, supported protocol  |
| No schemas visible     | Catalog permissions, default database, scope filters             |
| Some objects fail      | Object type support, permissions, identifier case, compatibility |

## Next steps

<CardGroup cols={2}>
  <Card title="Verify connectivity" href="/en/user-guide/installation/verify-installation" />
</CardGroup>
