citusdata / citusdata/citus

Improvement idea: Make undistribute_table udf lazy

Open
#4,157 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

When we call `undistribute_table` [udf](https://github.com/citusdata/citus/pull/3913), it inserts whole the data from citus table to a new local table.

However, for `DISTRIBUTE_BY_NONE` citus tables (reference tables & citus local tables), we could introduce a lazy & fast logic, like we did when implementing `create_citus_local_table` udf.
`create_citus_local_table` creates the shard of the citus local table by simply suffixing `shardId` to the name of the given input table, and to its objects (indexes, constraints etc.).

We can follow a similar approach for `undistribute_table` udf as well. This time, we should de-suffix the `shardId` from the local shard relation name and also from the objects on it.

That way, we could execute `undistribute_table` udf for coordinator-replicated reference tables & citus local tables really quick, not depending on the relation size.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.