create_reference_table() on a single-node Citus without having to copy the data?
- Dominant language
- C
- Stars
- 12.8k
- Forks
- 794
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 31
Description
Hello,
In a single-node configuration, is there a way to create a reference table from an existing table without having Citus to do a lengthy copy of the rows to the old table to the referenced one?
Technically it should be as simple as replacing that one underlying "shard" table that `create_reference_table()` creates but for whatever reason it doesn't work for me - I went as far as:
```sql
-- Rather large table that I would prefer to not copy as part of
-- create_reference_table() and instead just make it into a shard table
-- directly
CREATE TABLE test (id INT);
INSERT INTO test (id) SELECT i FROM generate_series(1, 10000) s(i);
SET client_min_messages TO DEBUG;
SET citus.enable_manual_changes_to_shards TO true;
-- Referenced table for which I intend to replace that one shard
CREATE TABLE test_referenced (LIKE test INCLUDING ALL);
SELECT create_reference_table('test_referenced');
-- At this point, create_reference_table() has created "test_referenced_102009"
-- shard for the reference table. How do I drop it and replace it with "test"
-- table without having to copy data between the tables?
```
Contributor guide
Assessment
This issue has not been assessed yet.