# Changing number of partitions in a topic

**URL:** <https://forum.confluent.io/t/changing-number-of-partitions-in-a-topic/7844>\
**Category:** Architecture and Design\
**Created:** [11 May 2023 22:18 UTC](https://forum.confluent.io/t/changing-number-of-partitions-in-a-topic/7844 "2023-05-11T22:18:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tibicuera](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/tibicuera/32/2972_2.png) [@Tibicuera](https://forum.confluent.io/u/Tibicuera)\
**Post date:** [11 May 2023 22:18 UTC](https://forum.confluent.io/t/changing-number-of-partitions-in-a-topic/7844/1 "2023-05-11T22:18:18Z")

</div>

In 2015 there was a question in stackoverflow about dynamically changing the number of partitions in a topic. After all these years and with the replacement zookeeper with KRaft, is it possible currently to dynamically change the number of partitions in a topic with no downtime? (This is for the case of needing to increase paralelism-performance in the consumer side.)

---

<div class="post-metadata">

**Author:** ![OneCricketeer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/onecricketeer/32/1551_2.png) [@OneCricketeer](https://forum.confluent.io/u/OneCricketeer)\
**Post date:** [16 May 2023 00:17 UTC](https://forum.confluent.io/t/changing-number-of-partitions-in-a-topic/7844/2 "2023-05-16T00:17:56Z")

</div>

Can you provide what you have tried so far? This command seems like it exists already?

```auto
kafka-topics --topic X --alter --partitions N

```

Help output

```auto
--partitions <Integer: # of partitions> The number of partitions for the topic
                                           being created or altered (WARNING:
                                           If partitions are increased for a
                                           topic that has a key, the partition
                                           logic or ordering of the messages
                                           will be affected). If not supplied
                                           for create, defaults to the cluster
                                           default.

```

---

<div class="post-metadata">

**Author:** ![Tibicuera](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/tibicuera/32/2972_2.png) [@Tibicuera](https://forum.confluent.io/u/Tibicuera)\
**Post date:** [16 May 2023 23:53 UTC](https://forum.confluent.io/t/changing-number-of-partitions-in-a-topic/7844/3 "2023-05-16T23:53:43Z")

</div>

I have not tried this on run-time. Was wondering what would be the consequence of increasing the number of partitions while the topic is being used. But I can try it.  
Thank you.

---

<div class="post-metadata">

**Author:** ![OneCricketeer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/onecricketeer/32/1551_2.png) [@OneCricketeer](https://forum.confluent.io/u/OneCricketeer)\
**Post date:** [17 May 2023 19:33 UTC](https://forum.confluent.io/t/changing-number-of-partitions-in-a-topic/7844/4 "2023-05-17T19:33:01Z")

</div>

Kafka clients refresh metadata every 5 minutes on their own. In the meantime, existing data will not be migrated when you increase partition count, and you will lose ordering on newly produced messages for any matching keys from previous records/partitions.
