Hello, I’m DocuDroid!
Submitting feedback
Thank you for rating our AI Search!
We would be grateful if you could share your thoughts so we can improve our AI Search for you and other readers.
GitHub

Rebalance and resize a cluster

Pavel Semyonov

Overview

For an MPP system, balanced data and workload distribution are crucial for overall performance. It ensures efficient parallel execution and helps avoid storage and computational skew. If some segment hosts store more data than others, they require more time to process their share of the workload, slowing down the entire system. In a balanced cluster, data and computation load are distributed evenly across all segment hosts.

With default initialization settings, Greengage DB creates a balanced cluster with an even distribution of segment instances among segment hosts. Under normal operation, the cluster remains balanced automatically. However, certain topology or configuration changes may cause balance disruption. For example, imbalance may appear after changing the number of segments, replacing hosts, recovering failed segments, or manual configuration changes.

Cases when cluster topology must be changed intentionally include:

  • Adding segment hosts to increase storage capacity.

  • Reducing the number of segments in a lightly loaded cluster.

  • Removing unused hosts after cluster downsizing.

  • Replacing hosts during hardware migration.

Such operations require redistribution of segments among hosts and table data among segments to preserve balance in the new topology.

Greengage DB allows modifying the topology of an existing cluster while maintaining a balanced state. This includes both:

  • physical topology — the set of segment hosts used by the cluster;

  • logical topology — the number of segments in the cluster.

Starting with version 7, Greengage DB provides the ggrebalance utility for performing such operations.

Balanced state

In this topic, a balanced cluster means that:

  • Each segment host contains the same number of primary segments.

  • Mirror segments are distributed according to the selected mirror policy (grouped or spread).

  • No primary segment and its mirror are located on the same host.

Note that in this context, balance refers to the physical distribution of segments among cluster hosts, not the distribution of table rows or workload. Evenly distributed table rows do not guarantee balanced physical topology. For example, a cluster may become physically unbalanced after segment recovery or topology changes even if all tables remain evenly distributed.

ggrebalance utility

The ggrebalance utility performs complex cluster topology changes while preserving balanced segment distribution and minimizing downtime.

To perform a topology change, ggrebalance generates and executes a rebalance plan based on the requested target topology. It is defined by utility options such as:

  • target segment count (required for all ggrebalance calls that start a new operation);

  • target segment hosts;

  • mirroring policy.

Using this information, ggrebalance determines how table data must be redistributed and which segment instances must be moved to different hosts.

Unlike gpexpand, ggrebalance automatically determines segment placement and does not require administrators to manually define a mapping between segments and hosts.

Whenever possible, ggrebalance performs operations in parallel to speed up execution.

The utility is stateful and reentrant. Its progress and metadata are stored in a service schema — ggrebalance — in the postgres database. This allows operations to be interrupted and resumed later. Depending on the execution stage, ggrebalance may also automatically roll back interrupted operations to return the cluster to its original state.

During some stages of rebalance, a temporary reduction of cluster availability is expected. For example, while a mirror segment is being moved, the corresponding primary segment temporarily operates without high availability protection. In order to move a primary segment (which is not supported directly), ggrebalance performs a switchover — a role swap during which the primary segment is stopped and restarted as a mirror. Because switchovers interrupt access to involved segments, ggrebalance requests explicit confirmation before performing each of them unless automatic confirmation is enabled.

IMPORTANT

In version 1.0, ggrebalance does not support cluster expansion. To increase the number of segments, use the gpexpand utility.

This topic describes how to use ggrebalance to rebalance and resize a cluster in different maintenance scenarios.

For additional background information about the utility and its implementation, see this Greengage DB blog post: What has been going on with shrink and Iceberg connector.

Supported topology changes

ggrebalance supports the following operations on cluster topology:

  • Returning an unbalanced cluster to a balanced state.

  • Changing the number of segments (cluster shrink).

  • Adding segment hosts.

  • Removing segment hosts.

  • Replacing segment hosts.

  • Changing the mirroring policy.

    NOTE

    In version 1.0, ggrebalance supports mirroring policy change only for unbalanced clusters when returning them to a balanced state.

  • Combining logical and physical topology changes in a single operation. For example, you can reduce the number of segments while replacing a subset of segment hosts.

Prerequisites

Before running ggrebalance, ensure that the cluster satisfies the following requirements:

  • The cluster is fully operational, without down segments. If the cluster contains unavailable segments, ggrebalance terminates with an error. Recover failed segments before starting rebalance operations using gprecoverseg.

  • The cluster is running in normal production mode. ggrebalance cannot run in maintenance mode or coordinator-only mode.

  • New segment hosts are configured the same way as for cluster expansion with gpexpand. This includes:

    • installing the same Greengage DB version;

    • preparing data directories;

    • configuring SSH connectivity;

    • exchanging SSH keys;

    • validating host accessibility and environment configuration.

Additionally, the following recommendations apply to ggrebalance usage:

  • Perform rebalance operations during low-use hours.

    Although ggrebalance minimizes downtime, some stages temporarily reduce cluster availability or require segment switchovers. Running rebalance during maintenance windows or off-peak hours reduces the impact on active workloads. See Run rebalance sessions to learn how to schedule rebalance sessions at the desired times.

  • Create a fresh cluster backup with gpbackup before topology changes.

    Although ggrebalance supports resuming interrupted operations and may automatically roll back incomplete changes, cluster topology modifications remain potentially destructive administrative operations. To learn how to install and use gpbackup, refer to the dedicated gpbackup and gprestore documentation.

See also the Prerequisites section of the ggrebalance utility reference.

View rebalance plan

A rebalance plan describes:

  • which segment instances will be moved;

  • source and destination hosts;

  • source and destination data directories;

  • estimated amount of transferred data.

ggrebalance generates plans automatically based on the requested target topology. The planner attempts to minimize data movement while preserving balanced segment distribution and mirror placement rules.

Because plan generation includes randomized balancing decisions, different ggrebalance calls with identical input parameters may lead to different balanced layouts. ggrebalance does not attempt to restore the exact original segment placement after topology changes.

To make plan generation deterministic, run ggrebalance with the --seed option specifying a number to use as a random seed for plan generation. When called with the same seed value and identical topology parameters, ggrebalance generates the same rebalance plan. This can be useful for testing, plan comparison, or repeating the exact same topology transformation. The current seed is shown in the ggrebalance output in a line like this:

[INFO]:-Running randomized plan improvement with seed:112000605749072073190442187284282172932

Before applying topology changes, you can preview the generated rebalance plan using the --show-plan option. Run ggrebalance with the --show-plan option together with the options that define the target topology:

$ ggrebalance --show-plan <other_options>

The output contains detailed information about planned rebalance operations and the resulting cluster configuration.

================================================================================
                                  SHRINK PLAN
================================================================================

Target Segment Count: 6

-------------------------------SEGMENTS TO REMOVE-------------------------------
Total segments to shrink: 2

  [1] Segment Pair:
      Primary:
        Content:  6
        DbId:     8
        Host:     sdw4
        Datadir:  /data1/primary/gpseg6
        Port:     10000
      Mirror:
        Content:  6
        DbId:     16
        Host:     sdw1
        Datadir:  /data1/mirror/gpseg6
        Port:     10500

  [2] Segment Pair:
      Primary:
        Content:  7
        DbId:     9
        Host:     sdw4
        Datadir:  /data1/primary/gpseg7
        Port:     10001
      Mirror:
        Content:  7
        DbId:     17
        Host:     sdw1
        Datadir:  /data1/mirror/gpseg7
        Port:     10501

---------------------------------BALANCE MOVES----------------------------------
Total moves planned: 6

  [1] Move Segment(content=0, dbid=10, role=m) [405.38 MB]
      From: sdw2:10500:/data1/mirror/gpseg0
      To:   sdw3:10502:/data1/mirror/gpseg0

  [2] Move Segment(content=1, dbid=11, role=m) [405.62 MB]
      From: sdw2:10501:/data1/mirror/gpseg1
      To:   sdw3:10503:/data1/mirror/gpseg1

  [3] Move Segment(content=2, dbid=4, role=p) [470.54 MB]
      From: sdw2:10000:/data1/primary/gpseg2
      To:   sdw4:10002:/data1/primary/gpseg2

  [4] Move Segment(content=2, dbid=12, role=m) [405.84 MB]
      From: sdw3:10500:/data1/mirror/gpseg2
      To:   sdw1:10502:/data1/mirror/gpseg2

  [5] Move Segment(content=3, dbid=5, role=p) [470.27 MB]
      From: sdw2:10001:/data1/primary/gpseg3
      To:   sdw4:10003:/data1/primary/gpseg3

  [6] Move Segment(content=3, dbid=13, role=m) [405.59 MB]
      From: sdw3:10501:/data1/mirror/gpseg3
      To:   sdw1:10503:/data1/mirror/gpseg3

================================================================================

Descriptions of plan steps contain information about the step type and the segments and hosts involved:

  • segment content ID;

  • segment database ID (dbid);

  • segment role (p for primary, m for mirror);

  • estimated amount of data to transfer (segment sizes before the operation);

  • source segment location;

  • target segment location.

Review the generated plan carefully before executing rebalance operations, especially when changing the number of segments or replacing hosts.

Return the cluster to a balanced state

If segment instances are distributed unevenly across the cluster hosts, ggrebalance can move them between hosts to restore a balanced cluster topology.

TIP

The following query shows the number of primary and mirror segments on each segment host:

SELECT hostname, COUNT(content), role
FROM gp_segment_configuration
GROUP BY hostname, role ORDER BY hostname;

Different numbers of primary or mirror segments on segment hosts indicate an unbalanced cluster. Example:

 hostname | count | role
----------+-------+------
 mdw      |     1 | p
 sdw1     |     1 | m
 sdw2     |     1 | m
 sdw2     |     1 | p
 sdw3     |     2 | m
 sdw3     |     4 | p
 sdw4     |     4 | m
(8 rows)

To restore cluster balance on the same set of hosts, run ggrebalance specifying the current number of primary segments in the -x/--target-segment-count option:

$ ggrebalance -x 8
NOTE

ggrebalance does not attempt to restore the original physical segment placement. Instead, the utility generates a rebalance plan leading to any valid balanced topology. As a result, segment instances may end up on different hosts compared to their original locations.

During rebalance, ggrebalance usually performs switchovers — role swaps between primary and mirror segments. A switchover temporarily interrupts access to the affected segment pair while the mirror is promoted to primary. Because of this, ggrebalance requests confirmation before executing switchovers. Enter y when a switchover confirmation prompt appears:

Following switchovers require approval:
Rebalance step with move_order: 2, status: APPROVE_REQUIRED, type: switchover from Primary to Mirror, DBID 4

Approve switchovers? Yy|Nn (default=Y):

To approve all switchovers automatically, use the -y/--approve-swap-roles option. See also Non-interactive mode.

When the operation is completed, ggrebalance prints its summary:

[INFO]:-Rebalance is complete
[INFO]:------------------------------------SUMMARY--------------------------------------
[INFO]:-================================================================================
[INFO]:-                                   REBALANCE
[INFO]:-================================================================================
[INFO]:-Segments moved:         13
[INFO]:-Rolled back moves:      0
[INFO]:-Cancelled moves:        0

After the operation completes, proceed to Post-rebalance actions to finalize it.

Change segment count

IMPORTANT

ggrebalance 1.0 supports only decreasing the number of segments (cluster shrink). To increase the number of segments, use the gpexpand utility.

Shrink

Cluster shrink decreases the number of segments in the system. This operation may be useful when the cluster contains too many small segments relative to the actual amount of stored data. In such cases, segment management overhead may outweigh the benefits of additional parallelism.

Cluster shrink can also be combined with topology changes such as host removal or host replacement. See Combined topology changes for an example of such an operation.

When shrinking the cluster, ggrebalance redistributes table data across the remaining segments while preserving balanced segment placement. Because of this, the target number of segments must be distributable evenly across the cluster’s segment hosts. For example:

  • A 12-segment cluster on 3 hosts can be shrunk to 9 or 6 segments.

  • An 8-segment cluster on 4 hosts cannot be shrunk to 6 segments without physical topology changes. For example, you can remove one host from the cluster or add two new ones.

During shrink, ggrebalance removes segments with the highest content_id values and redistributes their data across the remaining segment set. As a result, the sizes of remaining segments increase, and table redistribution may require substantial temporary I/O and network traffic.

To decrease the number of segments while keeping the same set of hosts, specify the target segment count smaller than the current one in the -x/--target-segment-count option:

$ ggrebalance -x 6

The operation may require user confirmation for certain steps, including switchovers. To approve switchovers automatically, use the -y/--approve-swap-roles option. To automatically select default options for all user interactions during the operation, use non-interactive mode.

When the operation is completed, ggrebalance prints its summary:

[INFO]:-Shrink is complete
[INFO]:------------------------------------SUMMARY--------------------------------------
[INFO]:-================================================================================
[INFO]:-                                   SHRINK
[INFO]:-================================================================================
[INFO]:-Tables shrunk:		4
[INFO]:-Shrink total time:	0d 0h0m12s

After the operation completes, proceed to Post-rebalance actions to finalize it.

Shrink without rebalance

ggrebalance can perform shrink without redistributing the resulting set of segments across hosts. For this purpose, use the --skip-rebalance option:

$ ggrebalance -x 6 --skip-rebalance

This operation redistributes table data across the reduced number of segments while leaving segment instances on their current hosts. As a result, the cluster usually becomes physically unbalanced.

This mode may be useful when:

  • shrink must be completed immediately;

  • rebalance is planned separately during a later maintenance window;

  • temporary imbalance is acceptable.

After completing shrink without rebalance, you can rebalance the cluster later in a separate operation.

First, remove the current ggrebalance schema:

$ ggrebalance -c

Then start a new rebalance operation while keeping the current segment count unchanged:

$ ggrebalance -x 6

Change segment hosts array

Cluster rebalance is often associated with changes in the set of segment hosts. Typical scenarios include:

  • Removing hosts to free up hardware resources.

  • Replacing hosts during hardware maintenance or data center migration.

  • Adding hosts to redistribute workload across more hardware resources.

    NOTE

    Although ggrebalance 1.0 cannot increase the number of segments in the cluster, it can redistribute cluster segments across a larger number of hosts. This may be useful for reducing resource utilization per host.

ggrebalance automatically distributes segment instances across the target set of hosts while preserving balanced topology rules.

You can define the target segment host array in two ways:

  • Describe changes relative to the current topology

    This approach is convenient for relatively small topology changes. In this case, you separately specify:

    • hosts to remove from the cluster (-R/--remove-hosts option);

    • hosts to add to the cluster (-A/--add-hosts option).

    For example, suppose a cluster currently contains hosts sdw1, sdw2, and sdw3, and you want to replace sdw3 with sdw4. In this case, remove sdw3 and add sdw4.

  • Define the complete target host set

    This approach is more convenient for large topology changes where most existing hosts are replaced or removed. In this case, specify the full list of hosts that should contain segment instances after rebalance using the -H/--target-hosts option.

    For the example above, specify the following target host list: sdw1,sdw2,sdw4. All the current segment hosts that are not listed (sdw3) will be removed from the cluster.

In both cases, host lists can be provided either in command-line arguments or using text files. For file-based configuration, use the corresponding *-file options: --add-hosts-file, --remove-hosts-file, and --target-hosts-file. The file must contain one hostname per line.

On newly added hosts, ggrebalance creates segment data directories in the default locations /data1/primary/gpseg<N> and /data1/mirror/gpseg<N>. To use different locations, specify target data directories using the -d/--target-datadirs or --target-datadirs-file options. The value consists of two directory paths: the primary segment directory and the mirror segment directory. In the -d values, pass them in a single string separated by a comma. When using --target-datadirs-file, specify one directory per line.

See the following sections for examples of specific topology change scenarios.

IMPORTANT

When changing the number of segment hosts, ensure that segment instances can be distributed evenly across the resulting host set. If balanced distribution is impossible with the current number of segments, perform a combined topology change and adjust the total number of segments accordingly.

Remove segment hosts

Removing segment hosts may be useful when the cluster contains more hardware resources than required. For example, the amount of stored data is smaller than expected, or resource utilization on cluster hosts is consistently low.

To remove hosts while preserving the current number of segments:

  • specify the current number of segments as the target number (-x);

  • specify the hosts to remove using either -R/--remove-hosts or --remove-hosts-file.

Example:

$ ggrebalance -x 6 -R sdw4

When removing more than one host, separate them with commas:

$ ggrebalance -x 6 -R 'sdw4,sdw5,sdw6'

The output should end with lines like the following:

[INFO]:-Rebalance is complete
[INFO]:------------------------------------SUMMARY--------------------------------------
[INFO]:-================================================================================
[INFO]:-                                   REBALANCE
[INFO]:-================================================================================
[INFO]:-Segments moved:         9
[INFO]:-Rolled back moves:      0
[INFO]:-Cancelled moves:        0

After the operation completes, proceed to Post-rebalance actions to finalize the operation.

Add segment hosts

Adding segment hosts allows redistributing workload across more hardware resources while preserving the current number of segments. This may be useful when CPU or memory utilization is high on existing hosts, or when you want to reduce resource contention without changing table distribution.

To add hosts while preserving the current number of segments:

  • specify the current number of segments as the target number (-x);

  • specify the hosts to add using either -A/--add-hosts or --add-hosts-file.

Example:

$ ggrebalance -x 6 -A sdw3

After successful completion, the utility prints a summary similar to the following:

[INFO]:-Rebalance is complete
[INFO]:------------------------------------SUMMARY--------------------------------------
[INFO]:-================================================================================
[INFO]:-                                   REBALANCE
[INFO]:-================================================================================
[INFO]:-Segments moved:         9
[INFO]:-Rolled back moves:      0
[INFO]:-Cancelled moves:        0

After the operation completes, proceed to Post-rebalance actions to finalize it.

If the cluster uses custom segment data directory locations instead of the default /data1/primary/gpseg<N> and /data1/mirror/gpseg<N>, specify them in the -d/--target-datadirs option. Example:

$ ggrebalance -x 6 -A sdw3 \
   -d '/data2/primary,/data2/mirror'

The directories must exist on the hosts being added.

Replace segment hosts

Replacing segment hosts allows migrating clusters to new hardware without changing the total number of hosts or segments. Typical use cases include replacing aging hardware, migrating the cluster to a new data center, or changing the hardware characteristics of the cluster.

To replace specific segment hosts, combine the options that remove and add segment hosts -R/--remove-hosts and -A/--add-hosts:

$ ggrebalance -x 6 -R sdw3 -A sdw4

If the cluster uses custom segment data directory locations, specify them using the -d/--target-datadirs option.

After successful completion, the utility prints a summary similar to the following:

[INFO]:-Rebalance is complete
[INFO]:------------------------------------SUMMARY--------------------------------------
[INFO]:-================================================================================
[INFO]:-                                   REBALANCE
[INFO]:-================================================================================
[INFO]:-Segments moved:	        12
[INFO]:-Rolled back moves:      0
[INFO]:-Cancelled moves:        0

After the operation completes, proceed to Post-rebalance actions to finalize it.

When replacing many hosts at once, for example during full cluster migration, it is convenient to specify the complete target host list in a file. This file must list all target segment hosts one per line, for example:

sdw1
sdw2
sdw3
sdw4

Pass the file to ggrebalance using the --target-hosts-file option:

$ ggrebalance -x 6 --target-hosts-file target_hosts

Change mirroring policy

NOTE

In version 1.0, ggrebalance supports mirroring policy change only for unbalanced clusters when returning them to a balanced state.

ggrebalance can change the cluster mirroring policy during rebalance using the -m/--mirror-mode option. Supported mirroring policies are grouped and spread.

The utility redistributes segment instances as necessary to achieve a balanced cluster topology that follows the selected mirror placement policy. For example, to convert a cluster created with the default grouped mirroring policy to spread mirroring, run:

$ ggrebalance -x 8 -m spread

Changing the mirror policy may require moving a large number of mirror segments between hosts. During these operations, affected primary segments may temporarily operate without mirror protection until synchronization completes.

After the operation completes, proceed to Post-rebalance actions to finalize it.

Combined topology changes

Real-world maintenance operations often require simultaneous logical and physical topology changes. For example, administrators may need to:

  • shrink the cluster while removing hosts;

  • replace hosts while redistributing segments;

  • change the mirroring policy during host migration.

ggrebalance can execute such combined topology changes as a single coordinated operation. This approach simplifies administration and preserves the ability to resume or roll back interrupted operations.

To perform a combined topology change, specify the parameters of the target topology using the appropriate options:

  • target number of primary segments (-x/--target-segment-count);

  • segment hosts to remove and add (-R/--remove-hosts, -A/--add-hosts);

  • complete target host list (-H/--target-hosts);

  • target data directories on new hosts (-d/--target-datadirs);

  • mirroring policy (-m/--mirror-mode).

As in other rebalance scenarios, the resulting topology must allow balanced segment distribution.

For example, the following command shrinks the cluster to 6 segments, removes hosts sdw2 and sdw3, and adds host sdw4:

$ ggrebalance -x 6 -R sdw3,sdw2 -A sdw4

In combined operations, ggrebalance executes topology changes in several phases.

  1. Shrink. The utility removes segments with the highest content_id values and redistributes their table data across the remaining segments while preserving the original host layout.

  2. Segment movement. The utility moves segment instances between hosts to achieve balanced distribution on the target physical topology.

After successful completion, the utility prints a summary containing information about all executed phases, for example:

[INFO]:-Rebalance is complete
[INFO]:------------------------------------SUMMARY--------------------------------------
[INFO]:-================================================================================
[INFO]:-                                   SHRINK
[INFO]:-================================================================================
[INFO]:-Tables shrunk:		4
[INFO]:-Shrink total time:	0d 0h1m48s
[INFO]:-================================================================================
[INFO]:-                                   REBALANCE
[INFO]:-================================================================================
[INFO]:-Segments moved:         12
[INFO]:-Rolled back moves:      0
[INFO]:-Cancelled moves:        0

After the operation completes, proceed to Post-rebalance actions to finalize it.

Configure rebalance process

Because topology changes may involve large-scale table redistribution, movement of segment instances between hosts, and other resource-intensive operations, total execution time may be significant depending on cluster size and workload.

ggrebalance provides flexible execution controls that help minimize service disruption, control rebalance operation flow, and utilize available resources optimally. These controls allow administrators to:

  • Split long operations into multiple sessions with limited execution time.

  • Control resource utilization during rebalance.

  • Reduce the impact on production workloads.

  • Monitor operation progress to detect possible issues early and roll back operations if required.

Run rebalance sessions

ggrebalance supports resumable rebalance sessions.

A rebalance operation may be interrupted and continued later without losing its progress. This allows administrators to execute topology changes gradually during scheduled maintenance windows or periods of low activity.

To run a limited rebalance session, use one of the following options:

  • -T/--duration — run rebalance for a specified amount of time in the HH:MM:SS format.

  • -E/--end — run the rebalance operation until a point in time specified in the YYYY-MM-DD HH:MM:SS format.

Examples:

  • Run a five-minute rebalance session:

    $ ggrebalance -x 6 -T 00:05:00
  • Run rebalance until 9 AM on May 31, 2026:

    $ ggrebalance -x 6 -E "2026-05-31 09:00:00"

When the specified time limit is reached, ggrebalance stops the current session safely and preserves the rebalance state.

To continue an interrupted rebalance operation later, use one of the following methods:

  • Run ggrebalance again without time limits to complete the operation in a single session.

  • Start another limited session using -T or -E.

Parallelism level

To improve resource utilization and reduce execution time, ggrebalance performs some operations in parallel whenever possible. The utility provides two independent parallelism controls:

  • -n/--parallel defines the maximum number of tables processed simultaneously during table redistribution operations such as cluster shrink.

  • -B/--batch-size defines the maximum number of segment relocation operations performed simultaneously during the rebalance phase.

Example:

$ ggrebalance -x 8 --parallel 8 --batch-size 4

Higher parallelism values may reduce total rebalance time but can also increase CPU utilization, disk I/O load, and the impact on active queries. Choose parallelism settings according to available cluster resources and maintenance requirements.

Non-interactive mode

During execution, ggrebalance may request user input or confirmation for potentially disruptive operations. For example, confirmation may be required before segment switchovers or rollbacks.

To avoid blocking execution while waiting for user input, enable non-interactive mode:

$ ggrebalance -x 6 --non-interactive-mode

In non-interactive mode, ggrebalance automatically selects default responses for all prompts.

If only automatic approval of segment role swaps is required, use the -y/--approve-swap-roles option instead. Example:

$ ggrebalance -x 6 -y

This option automatically approves switchovers that temporarily interrupt access to affected segment pairs. It may be useful during planned maintenance windows where short service interruptions are acceptable.

Monitor rebalance state

The following ways to monitor the rebalance process are available:

  • ggrebalance service schema;

  • ggrebalance utility log files.

ggrebalance schema

The ggrebalance schema is automatically created in the postgres database when a new rebalance operation is created (ggrebalance call with the -x option). The schema contains tables and views describing rebalance progress and operation state:

  • ggrebalance.rebalance_progress contains aggregated rebalance progress information.

    Example query:

    SELECT * FROM ggrebalance.rebalance_progress;

    Example result:

               stat_name            | stat_value
    --------------------------------+------------
     1.1. Tables shrunk             | 9
     1.2. Tables shrink in progress | 1
     1.3. Tables left to shrink     | 0
    (3 rows)

    When ggrebalance runs with the -D/--detailed-progress option, additional metrics become available, including the amount of processed and remaining data, estimated processing speed, and estimated remaining time.

               stat_name            |       stat_value
    --------------------------------+-------------------------
     1.1. Tables shrunk             | 9
     1.2. Tables shrink in progress | 1
     1.3. Tables left to shrink     | 0
     2.1. Bytes processed           | 154626408
     2.2. Bytes left to process     | 132349952
     2.3. Bytes in progress         | 132349952
     3.1. Estimated shrink rate     | 16.237520440730542 MB/s
     3.2. Estimated time            | 7.773277358493123 s
    (8 rows)
  • ggrebalance.segment_move_steps stores information about each step of the rebalance plan. This table can be used to monitor the execution state of segment relocation operations.

    Example query:

    SELECT move_order, status FROM ggrebalance.segment_move_steps ORDER BY move_order;

    Example result:

     move_order |   status
    ------------+-------------
              0 | DONE
              1 | DONE
              2 | DONE
              3 | DONE
              4 | PLANNED
              5 | APPROVE_REQUIRED
              6 | PLANNED
              7 | APPROVE_REQUIRED
              8 | PLANNED
              9 | PLANNED
    (10 rows)

    Note that step descriptions are stored in this table in serialized form and are not intended for human interpretation. Use the step numbers together with the text plan description that ggrebalance outputs before executing the operation.

  • ggrebalance.table_rebalance_status_detail stores information about redistribution of individual tables.

    Example query:

    SELECT * FROM ggrebalance.table_rebalance_status_detail;

    Example result:

     db_name  | schema_name | rel_name | status | rebalance_type |       rebalance_started       |      rebalance_finished       | source_bytes
    ----------+-------------+----------+--------+----------------+-------------------------------+-------------------------------+--------------
     postgres | public      | table3   | none   | SHRINK         | 2026-05-26 09:28:31.580574+00 |                               |    132349952
     postgres | public      | table4   | done   | SHRINK         | 2026-05-26 09:28:31.584082+00 | 2026-05-26 09:28:36.956568+00 |     22447296
     postgres | public      | table2   | done   | SHRINK         | 2026-05-26 09:28:31.576651+00 | 2026-05-26 09:28:37.008942+00 |     22636880
     postgres | public      | table1   | none   | SHRINK         | 2026-05-26 09:28:31.557167+00 |                               |     64159744
    (4 rows)

ggrebalance log files

By default, ggrebalance writes execution logs to files named ggrebalance_YYYYMMDD.log. The log files are stored in the gpAdminLogs subdirectory of the gpadmin user’s home directory on the coordinator host. You can change the ggrebalance log location using the -l/--log-dir option.

To increase log verbosity, use the --verbose option.

To suppress console output while continuing to write log files, use the --quiet option.

Post-rebalance actions

After a rebalance operation completes successfully, ggrebalance prints the following message:

[INFO]:-Rebalance is complete

Additionally, the ggrebalance.rebalance_status table contains a row with the state value STATE_EXECUTOR_DONE:

SELECT *
FROM ggrebalance.rebalance_status
WHERE state = 'STATE_EXECUTOR_DONE';

Example result:

        state        | state_category |            updated
---------------------+----------------+-------------------------------
 STATE_EXECUTOR_DONE | MAIN           | 2026-05-25 10:31:26.635473+00
(1 row)

This section describes steps that you may need to perform after the rebalance is completed.

Remove the rebalance schema

The ggrebalance schema is no longer needed after rebalance is complete. However, it is recommended to keep the schema until the new cluster topology and workload behavior are validated successfully. As long as the schema exists, rebalance metadata remains available and rollback operations are still possible.

To remove the schema, call ggrebalance with the -c/--clean option:

$ ggrebalance -c
NOTE

A new rebalance operation cannot be started while the ggrebalance schema exists in the cluster.

Collect statistics

After topology changes or table redistribution, optimizer statistics may no longer accurately reflect the new data distribution. Collect fresh statistics to ensure that the optimizer generates efficient execution plans for the updated cluster layout.

You can collect statistics using the ANALYZE command or analyzedb utility. Alternatively, use the -a/--analyze option to make ggrebalance automatically collect statistics after completing rebalance operations. Example:

$ ggrebalance -x 6 -a

Keep in mind that this can significantly increase operation time for large data volumes.

Rollback a rebalance operation

If an error occurs during rebalance, ggrebalance attempts to roll back incomplete changes automatically whenever possible.

Additionally, administrators can manually roll back completed or interrupted rebalance operations while the ggrebalance schema still exists.

To start a rollback, run:

$ ggrebalance -r

This manual rollback mechanism is primarily intended for reverting segment relocation operations if the resulting performance characteristics do not match expectations or if hardware migration must be reverted.

IMPORTANT
  • Rollback is available only while rebalance metadata remains stored in the ggrebalance schema.

  • Cluster shrink operations cannot be rolled back once completed. After shrink completes, removed segments no longer exist in the cluster topology, and their original placement metadata is discarded.

Example rollback summary:

[INFO]:-Rebalance rollback is complete
[INFO]:------------------------------------SUMMARY--------------------------------------
[INFO]:-================================================================================
[INFO]:-                                   SHRINK
[INFO]:-================================================================================
[INFO]:-Tables shrunk:		4
[INFO]:-Shrink total time:	0d 0h0m11s
[INFO]:-================================================================================
[INFO]:-                                   REBALANCE
[INFO]:-================================================================================
[INFO]:-Segments moved:         0
[INFO]:-Rolled back moves:      10
[INFO]:-Cancelled moves:        0