I have couple of tables in a Postgres database which I exported to a YugaByte cluster. While exporting, I used the same schema of the table containing the primary key but did not explicitly mention any partition key. For example, for Table 1, we have four fields as primary key (A, B, C, D). Now, as per documentation, YugaByte automatically picks up field A as the partition key and the rest (B, C, D) as the clustering key.
However, I want to change the partition key to (A, B, C, D) for the table and redistribute the data in the cluster.
I have tried removing the primary key constraint and adding a new constraint by below statement:
ALTER TABLE <table_name> DROP CONSTRAINT <table_name>_pkey;
ALTER TABLE <table_name> ADD PRIMARY KEY ((A, B, C, D));
The process was fast for small tables but for tables with large data it is taking forever. Is there any efficient way to change the partition key?