# Specify Copies

The `Specify copies` option in the [Hop Gui pop-up dialog](/data-shaper-1.21/knowing-the-data-shaper-designer/index/hop-gui-popup-dialog.md) is a powerful option that allows pipeline developers to run transforms in multiple copies.

Having multiple copies of a transform results in multiple threads for this transform, and can improve a pipeline’s performance if used correctly.

{% hint style="danger" %}
Warning: Increasing the number of copies for your transforms is not a silver bullet or a `performance=fast` option. Excessive use of the `specify copies` option can easily make your pipelines performance worse instead of better.
{% endhint %}

### Changing the number of copies for a transform

Click on a transform’s icon and click on the `Specify copies` icon in the pop-up dialog.

<img src="/files/cBL4lvk801DkxPbBu8bb" alt="Specify copies" width="209">

Change the number of copies for the selected transform in the dialog that will pop up:

<img src="/files/HQDO31yHBuVPQkDasbNq" alt="Specify copies dialog" width="266">

Your transform will now show the number of copies you specified in the upper left corner of the transform’s icon.

<img src="/files/0Fb2O45JlDAhQFgVR1jb" alt="Specify 4 copies" width="375">

When your pipeline starts, Apache Hop will create the specified number of copies for this transform in the background. The pipeline in the example above will look like the image below when executed.

<img src="/files/8Yj3JAAk3vRXM7p3k3R1" alt="Specify copies expanded" width="375">

### Use cases

Increasing the number of copies for a limited number of transforms in your pipelines can help to improve your pipeline’s performance, but the option should be used with great care.

the number of threads your CPUs or cores can handle is finite. Increasing the number of copies (and thus threads) can easily exceed what your system can handle, resulting in the opposite effect of what you want to achieve.

There are no hard rules, use common sense to decided when (not) to increase the number of copies for your transforms.

A number of guidelines to decide if using multiple copies for your transforms makes sense:

* is there a performance problem? If your pipeline is fast enough, there’s no need for multiple copies on any of your transforms.
* Identify the slowest transforms in your pipeline. Transforms that are a bottleneck get a dotted border during execution in Hop Gui. Are these bottleneck transforms CPU bound?\
  If the CPU is not the bottleneck, increasing the number of copies won’t help.
* Increasing the number of copies for e.g. relational databases transforms like [Table output](https://github.com/mbertazz/hop-docs-md/blob/main/modules/ROOT/pages/pipeline/pipeline/transforms/tableoutput.mtnxBKCSUf) depends on the technology you use. Some databases can handle multiple threads (transactions). Check the documentation for the technology in your data architecture.
* Some of the following transforms can be CPU heavy and may perform better with multiple copies. Once again: there’s no need to increase the number of copies if there are no performance problems or if these transforms are not the bottleneck in your pipeline.
  * [Calculator](/data-shaper-1.21/knowing-the-data-shaper-designer/pipelines/transforms/calculator.md)
  * [Formula](/data-shaper-1.21/knowing-the-data-shaper-designer/pipelines/transforms/formula.md)
  * [Javascript](/data-shaper-1.21/knowing-the-data-shaper-designer/pipelines/transforms/javascript.md)
  * [Script](/data-shaper-1.21/knowing-the-data-shaper-designer/pipelines/transforms/script.md)
  * [Sort rows](/data-shaper-1.21/knowing-the-data-shaper-designer/pipelines/transforms/sort.md)
  * [User defined Java class](/data-shaper-1.21/knowing-the-data-shaper-designer/pipelines/transforms/userdefinedjavaclass.md)
  * [User defined java expression](/data-shaper-1.21/knowing-the-data-shaper-designer/pipelines/transforms/userdefinedjavaexpression.md)

{% hint style="info" %}
Tip: As with any performance optimization exercises, make tiny changes and measure performance before and after applying any changes.
{% endhint %}

A special word of caution: when using multiple copies on a [Sort rows](/data-shaper-1.21/knowing-the-data-shaper-designer/pipelines/transforms/sort.md) transform, you **need** to add a [Sorted merge](/data-shaper-1.21/knowing-the-data-shaper-designer/pipelines/transforms/sortedmerge.md) transform, like in the screenshot below. The multiple copies of your `Sort rows` transform will each sort a subset of your stream. The `Sorted merge` transform will merge the (sorted) outputs of each of the `Sort rows` copies into a fully sorted output stream.

<img src="/files/lFf7qzbkfFHUdh0MDvYQ" alt="Specify copies with sort rows" width="563">


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.primeur.com/data-shaper-1.21/knowing-the-data-shaper-designer/pipelines/specify-copies.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
