# Kategoriebaum neu aufbauen schneller machen? CLI

**URL:** <https://forum.shopware.com/t/kategoriebaum-neu-aufbauen-schneller-machen-cli/91165>\
**Category:** Shopware 5\
**Created:** [28. Oktober 2021 um 13:08 UTC](https://forum.shopware.com/t/kategoriebaum-neu-aufbauen-schneller-machen-cli/91165 "2021-10-28T13:08:19Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)\
**Post date:** [28. Oktober 2021 um 13:08 UTC](https://forum.shopware.com/t/kategoriebaum-neu-aufbauen-schneller-machen-cli/91165/1 "2021-10-28T13:08:19Z")

</div>

ich verwende den CLI Befehl

```auto
php bin/console sw:rebuild:category:tree

```

Das dauert leider ewig (482468 items).  
Es wird immer ca. 1 item pro Sekunde abgearbeitet.  
Kann man an den CLI-Befehl einen Parameter hängen oder gibt es eine Art Batch-Modus?

Danke und Gruss.

---

<div class="post-metadata">

**Author:** ![SteinGruppe](https://avatars.discourse-cdn.com/v4/letter/s/e9a140/32.png) [@SteinGruppe](https://forum.shopware.com/u/SteinGruppe)\
**Post date:** [4. November 2021 um 14:46 UTC](https://forum.shopware.com/t/kategoriebaum-neu-aufbauen-schneller-machen-cli/91165/2 "2021-11-04T14:46:13Z")

</div>

Guten Tag,

als Frage vorweg, müssen Sie das neu aufbauen über CLI machen?

Shopware bietet unter Performance → Einstellungen → Kategorien eine Funktion dafür,  
dort können Sie den Aufbau auch in den Batch-Modus verschieben und die Stapelgröße  
bis zu 1500 anpassen.

Ich hoffe ich rede nicht komplett am Thema vorbei.

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/4/4017f25224c1939a389e6fa16305e0812c0ac26a.png)

Mit freundlichen Grüßen  
Marvin Kriebel

---

<div class="post-metadata">

**Author:** ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)\
**Post date:** [4. November 2021 um 15:09 UTC](https://forum.shopware.com/t/kategoriebaum-neu-aufbauen-schneller-machen-cli/91165/3 "2021-11-04T15:09:19Z")

</div>

Hi, im Backend bricht es ab. Deshalb nutze ich console.  
Nun ist es so, dass er in der console erst langsam ist und dann „mit einem rutsch“ ist alles fertig, ist das ggf auch ein absturz?  
Es sind 1,8mio Einträge und es sieht „normal“ aus.

---

<div class="post-metadata">

**Author:** ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)\
**Post date:** [6. April 2022 um 11:36 UTC](https://forum.shopware.com/t/kategoriebaum-neu-aufbauen-schneller-machen-cli/91165/4 "2022-04-06T11:36:06Z")

</div>

Nochmal nachgefragt.  
Wie kann ich im CLI eine Stapelgrösse angeben?

```auto
php bin/console sw:rebuild:category:tree

```

Danke und Gruss

---

<div class="post-metadata">

**Author:** ![herieth](https://avatars.discourse-cdn.com/v4/letter/h/898d66/32.png) [@herieth](https://forum.shopware.com/u/herieth)\
**Post date:** [6. April 2022 um 16:56 UTC](https://forum.shopware.com/t/kategoriebaum-neu-aufbauen-schneller-machen-cli/91165/5 "2022-04-06T16:56:55Z")

</div>

Hallo,  
hilft das vielleicht?

```auto
bin/console help sw:rebuild:category:tree
Description:
  Rebuild the category tree

Usage:
  sw:rebuild:category:tree [options]

Options:
  -o, --offset[=OFFSET] Offset to start with.
  -l, --limit[=LIMIT] Categories to build per batch. Default: 1000
  -h, --help Display this help message
  -q, --quiet Do not output any message
  -V, --version Display this application version
      --ansi Force ANSI output
      --no-ansi Disable ANSI output
  -n, --no-interaction Do not ask any interactive question
      --process-isolation Launch commands from shell as a separate process.
  -e, --env=ENV The Environment name. [default: "production"]
  -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Help:
  The sw:rebuild:category:tree command will rebuild your category tree.

```

---

<div class="post-metadata">

**Author:** ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)\
**Post date:** [7. April 2022 um 14:17 UTC](https://forum.shopware.com/t/kategoriebaum-neu-aufbauen-schneller-machen-cli/91165/6 "2022-04-07T14:17:14Z")

</div>

Leider nein.

```auto
 The "--limit" option does not exist.

```

---

<div class="post-metadata">

**Author:** ![herieth](https://avatars.discourse-cdn.com/v4/letter/h/898d66/32.png) [@herieth](https://forum.shopware.com/u/herieth)\
**Post date:** [7. April 2022 um 20:26 UTC](https://forum.shopware.com/t/kategoriebaum-neu-aufbauen-schneller-machen-cli/91165/7 "2022-04-07T20:26:27Z")

</div>

Hm,  
hier auf der Testumgebung läuft es

```auto
bin/console sw:rebuild:category:tree -l 100
Removing orphans
Rebuild path info
Removing assignments
Counted 9039 items
 9039/9039 [============================] 100% Elapsed: 33 secs
Done

```

V5.7.7 auf Debian 10 PHP 7.4

---

<div class="post-metadata">

**Author:** ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)\
**Post date:** [8. April 2022 um 06:25 UTC](https://forum.shopware.com/t/kategoriebaum-neu-aufbauen-schneller-machen-cli/91165/8 "2022-04-08T06:25:24Z")

</div>

Ahh, war beim falschen CLI, jedoch bei mir geht er die einzeln durch. Siehe unten. 24, und nicht 1500-Schritte

```auto
web1@xxx1:~$ /opt/php-7.4/bin/php /var/www/clients/client1/web1/web/bin/console sw:rebuild:category:tree -l 1500
Removing orphans
Rebuild path info
Removing assignments
Counted 573423 items
     24/573423 [>---------------------------] 0% Elapsed: 52 secs

```

SW 5.6.7

---

<div class="post-metadata">

**Author:** ![herieth](https://avatars.discourse-cdn.com/v4/letter/h/898d66/32.png) [@herieth](https://forum.shopware.com/u/herieth)\
**Post date:** [8. April 2022 um 07:26 UTC](https://forum.shopware.com/t/kategoriebaum-neu-aufbauen-schneller-machen-cli/91165/9 "2022-04-08T07:26:50Z")

</div>

Hallo,  
also bei mir zählt er die Schritte, nicht die Items. Das heißt bei 9039 Items mit Limit 100 sehe ich 90 Schritte. Allerdings passt dazu bei dir nicht die 24 und 0% aber vielleicht stimmt die % Anzeige nicht?  
Oder es ist die Version 5.6.7 … Dazu kann ich nix sagen  
Gruß  
Helmut

---

<div class="post-metadata">

**Author:** ![herieth](https://avatars.discourse-cdn.com/v4/letter/h/898d66/32.png) [@herieth](https://forum.shopware.com/u/herieth)\
**Post date:** [8. April 2022 um 07:29 UTC](https://forum.shopware.com/t/kategoriebaum-neu-aufbauen-schneller-machen-cli/91165/10 "2022-04-08T07:29:00Z")

</div>

Jo, die Anzeige ist es

```auto
Counted 9039 items
 9039/9039 [============================] 100% Elapsed: 14 secs
Done
helmut@STAT dev.sw.local$ bin/console sw:rebuild:category:tree --limit 100
Removing orphans
Rebuild path info
Removing assignments
Counted 9039 items
   85/9039 [>---------------------------] 0% Elapsed: 13 secs

```

---

<div class="post-metadata">

**Author:** ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)\
**Post date:** [8. April 2022 um 07:30 UTC](https://forum.shopware.com/t/kategoriebaum-neu-aufbauen-schneller-machen-cli/91165/11 "2022-04-08T07:30:57Z")

</div>

ok, aber dann funktioniert es bei dir ja auch nicht? 85 sind nicht 100.

---

<div class="post-metadata">

**Author:** ![herieth](https://avatars.discourse-cdn.com/v4/letter/h/898d66/32.png) [@herieth](https://forum.shopware.com/u/herieth)\
**Post date:** [8. April 2022 um 07:54 UTC](https://forum.shopware.com/t/kategoriebaum-neu-aufbauen-schneller-machen-cli/91165/12 "2022-04-08T07:54:16Z")

</div>

Doch: ich habe halt im Prozess kopiert, da musste ich schnell sein bevor er durch ist.  
Und nicht 100 sondern 91: 90 Schritte x 100 Items + 1 für den Rest 39.

Aber grundsätzlich zeigt er im Prozess bei mir keinen Fortschritt an. Springt also beim letzten Schritt auf 100%
