citusdata / citus

Distributed PostgreSQL as an extension
https://www.citusdata.com
GNU Affero General Public License v3.0
10.42k stars 662 forks source link

create_distributed_table can't inherit tablespace #3793

Open xieyuheng1025 opened 4 years ago

xieyuheng1025 commented 4 years ago

create_distributed_table can't inherit tablespace

Green-Chan commented 1 month ago

+1 Is there any way to place shards into a specified tablespace?

hanefi commented 1 month ago

After creating the shards, you can run something like the following:

SELECT *
  FROM run_command_on_shards(
    'my_distributed_table',
    $cmd$
        ALTER TABLE %s SET TABLESPACE new_tablespace
    $cmd$
  );
xieyuheng1025 commented 1 month ago

Thank you

Green-Chan commented 1 month ago

Thank you @hanefi , it worked!

hanefi commented 1 month ago

Reopening this issue as I believe this is a valid feature request. Citus can manage tablespaces of shards automatically if the necessary changes are made.