> ## 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.

# SQL Review Overview

> Review SQL for quality, performance, and operational risk before it reaches a target environment.

PawSQL SQL Review applies database-aware static analysis and policy checks before SQL reaches a target environment. Each review produces structured findings with severity, rule context, affected objects, and recommended action—giving developers, DBAs, and release teams a shared basis for remediation and approval.

## Review lifecycle

A ticket moves through the following states from creation to execution:

```mermaid theme={null}
flowchart TD
    A["Create ticket"] --> B["Automated review"]
    B --> C["Review results and resolve findings"]
    C --> D["Submit for review"]
    D --> E["Approval"]
    E --> F["Execution"]
```

To complete your first review, follow these operating steps (the first three prepare the inputs to ticket creation):

<Steps>
  <Step title="Define the review target">
    Identify the database engine, version, project, and environment where the SQL will run.
  </Step>

  <Step title="Choose a policy">
    Select a policy built for the target database and verify its rules, severities, and thresholds.
  </Step>

  <Step title="Prepare SQL and context">
    Paste statements or upload a script, and attach a workspace when object metadata is needed.
  </Step>

  <Step title="Create the review ticket">
    Fill in the title and priority, submit, and wait for the automated review to finish.
  </Step>

  <Step title="Resolve and disposition findings">
    Address the highest-risk items first, run the review again, and document any accepted exceptions.
  </Step>

  <Step title="Submit for review and approval">
    Submit the ticket for human review, have an approver decide, and track execution through the execution records after approval.
  </Step>
</Steps>

## Key concepts

| Concept       | Purpose                                                                          |
| ------------- | -------------------------------------------------------------------------------- |
| Review ticket | Captures the submitted SQL, review configuration, status, and results            |
| Review policy | Defines enabled rules, severity assignments, and configurable thresholds         |
| Workspace     | Supplies the engine, version, schema scope, and database object metadata         |
| Finding       | Identifies the rule, risk, source location, and affected database objects        |
| Review report | Summarizes statement coverage, risk distribution, rule activity, and disposition |

<Note>
  This guide uses **review policy** throughout. The interface's navigation and form display **review template**, and the template page's create button reads **create rule template**—all the same reusable collection of rules, severities, thresholds, and exceptions.
</Note>

## In this section

### Run a review

<CardGroup cols={2}>
  <Card title="Create a review ticket" href="/en/user-guide/sql-audit/create-review-task" />

  <Card title="Read review results" href="/en/user-guide/sql-audit/read-audit-results" />

  <Card title="Resolve findings" href="/en/user-guide/sql-audit/resolve-findings" />

  <Card title="Manual review and approval" href="/en/user-guide/sql-audit/manual-review-and-approval" />

  <Card title="History, reports, and export" href="/en/user-guide/sql-audit/history-reports-and-export" />
</CardGroup>

### Configuration and governance

<CardGroup cols={2}>
  <Card title="Review policy" href="/en/user-guide/sql-audit/select-audit-policy" />

  <Card title="Workspace and review context" href="/en/user-guide/sql-audit/configure-review-context" />

  <Card title="Control high-risk SQL" href="/en/user-guide/sql-audit/high-risk-sql-control" />
</CardGroup>

## Recommended paths by role

| Role                  | Start with                                    | Primary objective                              |
| --------------------- | --------------------------------------------- | ---------------------------------------------- |
| Developer             | Create a ticket, submit SQL, resolve findings | Catch issues before code review or release     |
| DBA                   | Policy, context, and result interpretation    | Assess database impact and remediation options |
| Reviewer              | High-risk control and manual approval         | Govern exceptions and make release decisions   |
| Project administrator | Policies, permissions, and reports            | Maintain standards and an auditable process    |

## Before you begin

* Confirm the target database engine and version.
* Use a review policy designed for that database.
* Verify script encoding, dialect, and statement delimiters.
* Prepare a workspace when the review depends on object metadata.
* Remove or mask sensitive values in SQL, DDL, comments, and logs.
* Confirm that your account can create and view review tickets.

<Warning>
  Automated review improves coverage and consistency. It does not replace business validation, testing, backup planning, change approval, or rollback preparation.
</Warning>

## Related resources

* Product capability: [SQL Review](/en/features/sql-review)
* Database metadata: [Workspaces and Database Context](/en/user-guide/workspaces/)
* Automated enforcement: [SQL Quality Gate for CI/CD](/en/use-cases/sql-quality-gate-cicd)
