Re: Object movement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Holger !
I think we can do it as below.

\c <database>
 alter table all in tablespace tbs1 set tablespace tbs2;
 select schemaname,tablename,tablespace,tableowner from pg_tables where tablespace=' tbs2';


On Wed, Feb 16, 2022 at 2:10 PM Holger Jakobs <holger@xxxxxxxxxx> wrote:
Am 16.02.22 um 09:36 schrieb Daulat:
> Hello,
>
> How can we move the object (tables etc.) of one database from another
> tablespace in postgres?
>
> Thanks

Move an object to a new tablespace:

ALTER objectName SET TABLESPACE newTablespace


You cannot move an object to a new database. You would have to re-create
it there.

--
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012


[Index of Archives]     [Postgresql Home]     [Postgresql General]     [Postgresql Performance]     [Postgresql PHP]     [Postgresql Jobs]     [PHP Users]     [PHP Databases]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Forum]

  Powered by Linux