Converting MergeTree to Replicated

Options here are:

  1. UseINSERT INTO foo_replicated SELECT * FROM foo .
  2. Create table aside and attach all partition from the existing table then drop original table (uses hard links don’t require extra disk space). ALTER TABLE foo_replicated ATTACH PARTITION ID 'bar' FROM 'foo' You can easily auto generate those commands using a query like: SELECT DISTINCT 'ALTER TABLE foo_replicated ATTACH PARTITION ID '' || partition_id || '' FROM foo' from WHERE table = 'foo'
  3. Do it ‘in place’ using some file manipulation. see the procedure described here:
  4. Do a backup of MergeTree and recover as ReplicatedMergeTree.
  5. Embedded command for that should be added in future.