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

# What are workflows?

> PlanetScale workflows provide pre-defined recipes that make it simple to run operations on your databases, including moving tables between keyspaces and importing external databases.

PlanetScale workflows are built on top of [Vitess VReplication](https://vitess.io/docs/reference/vreplication/vreplication/) and provide a managed way to move data between database sources with real-time progress tracking, data verification, and controlled traffic switching.

There are two types of workflows available:

<CardGroup cols={2}>
  <Card title="Table movement" icon="arrow-right-arrow-left" href="#table-movement-workflows">
    Move tables between keyspaces within your PlanetScale database. Used for sharding, resharding, and reorganizing data.
  </Card>

  <Card title="Database import" icon="download" href="#database-import-workflows">
    Import data from an external MySQL or MariaDB database into PlanetScale with no downtime.
  </Card>
</CardGroup>

## Table movement workflows

Table movement workflows let you move tables from one [keyspace](/vitess/sharding/keyspaces) to another within your PlanetScale database. If you are familiar with [Vitess](https://vitess.io/), these are analogous to the [Vitess `MoveTables` workflow](https://vitess.io/docs/user-guides/migration/move-tables/).

Available table movement workflows:

* **Unsharded to sharded** — Move tables from an unsharded keyspace to a new sharded keyspace. This is the primary way to shard existing tables. See the [Sharding quickstart](/vitess/sharding/sharding-quickstart).
* **Sharded to sharded** — Move tables between sharded keyspaces to change the number of shards. See [Modifying the number of shards](/vitess/sharding/sharding-a-sharded-keyspace).
* **Unsharded to unsharded** — Move tables from one unsharded keyspace to another unsharded keyspace.

Table movement workflows can be created from the dashboard, the [CLI](/cli/workflow), or the [API](/api/reference/create_workflow).

## Database import workflows

Database import workflows let you migrate data from an **external internet-accessible MySQL or MariaDB database** into PlanetScale with no downtime. The import workflow handles connection setup, schema validation, data copying, real-time replication, and controlled traffic switching.

Database import workflows are created through the PlanetScale dashboard. To get started, go to **New database** > **Import database**.

For a full walkthrough, see the [Database imports documentation](/vitess/imports/database-imports).

## Shared workflow lifecycle

Both workflow types follow a similar lifecycle:

1. **Copying** — Initial data copy from source to target
2. **Running** — Real-time replication keeps source and target in sync
3. **Switching traffic** — Controlled cutover of replica and primary traffic to the target
4. **Complete** — Workflow finalized and source connection closed

For the full list of states specific to table movement workflows, see the [Workflow state reference](/vitess/sharding/sharding-workflow-state-reference). For import workflow states, see [Workflow phases](/vitess/imports/database-imports#workflow-phases).

## Create a workflow

To create a new workflow, select your database and click **Workflows** in the left nav, then click **New workflow**. You'll be prompted to choose between moving tables between keyspaces or importing from an external database.

You can also create table movement workflows using the [`pscale workflow create`](/cli/workflow) CLI command or the [Create workflow API endpoint](/api/reference/create_workflow).

<Note>
  Database import workflows can only be created through the PlanetScale dashboard. The CLI and API `create` commands are for table movement workflows only. Once created, all other workflow lifecycle commands (`switch-traffic`, `verify-data`, `complete`, `cancel`, etc.) work with both workflow types.
</Note>

## View workflow history

To view the history of all completed or pending workflows, click on **Workflows** in the left nav. From here, you can see all previous workflows along with information such as status, duration, and the time it took to complete.

## Need help?

Get help from [the PlanetScale Support team](https://planetscale.com/contact?initial=support), or join our [Discord community](https://pscale.link/community) to see how others are using PlanetScale.
