Now for table redistribution, a tuplestore might be necessary to store the data necessary to redistribute.
However, we can avoid that by using a batch processing. In order to do that, we will basically need 2 connections to each remote node:
- 1 to fetch the data
- 1 to send the data through
What is really challenging in this case is that the 2 connections will be in the same session on cluster.
In PostgreSQL, having 2 sessions running in parallel is extremely dangerous for MVCC, as for example it is not possible to commit twice the same transaction ID on remote nodes.