Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id A67289FB1C6 for ; Tue, 6 Feb 2007 11:45:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 64772-03 for ; Tue, 6 Feb 2007 11:44:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 000E39FA297 for ; Tue, 6 Feb 2007 11:44:52 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Tue, 6 Feb 2007 15:44:51 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 06 Feb 2007 09:44:51 -0600 Subject: Re: Moving a table to another directory From: Scott Marlowe To: Jaime Casanova Cc: Ezequiel Luis Pellettieri , "Milen A. Radev" , pgsql-admin@postgresql.org In-Reply-To: References: <86aad3420702051141u6903bc7evea2ff90dd9ecda00@mail.gmail.com> <45C79018.2080101@radev.net> <86aad3420702051826g321829a1t3c0f112819c6e767@mail.gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Message-Id: <1170776691.5451.93.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 06 Feb 2007 09:44:51 -0600 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/81 X-Sequence-Number: 24546 On Mon, 2007-02-05 at 21:03, Jaime Casanova wrote: > > 2007/2/5, Milen A. Radev : > > > Ezequiel Luis Pellettieri =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0: > > > > Hi guys I have a big table (25 gb) and a need to move it to another > > > > directory cos i'm out of space. > > > > making a symlik will be ok? or I have to do something else > > > > > > > > > > > > > 1. CREATE TABLESPACE xxx LOCATION 'another_dir' > > > ( > > http://www.postgresql.org/docs/current/static/sql-createtablespace.html= ); > > > > > > 2. ALTER TABLE big_table SET TABLESPACE xxx; > > > > > (http://www.postgresql.org/docs/current/static/sql-altertable.html > > ) > > > > On 2/5/07, Ezequiel Luis Pellettieri wro= te: > > Thanks Milen, does it work on 7.4?? > > >=20 > oops... your symlink will be ok... use the contrib oid2name to > identify the files corresponding to that table... and maybe the > indexes as well... >=20 > what i remember from the ancient era pre-tablespace (2 or 3 years ago) > is that a pg_dump and/or reindex will return all to it's original > state... Note that you've also got the option of using initlocation. This only allows you to create entire databases on alternate storage location, not individual tables. If you DO go with symlinks, certain operations may result in losing the link and recreating the table in the local directory (i.e. anything that would change the OID assigned to that table, as I believe cluster and reindex would do) See=20 http://www.postgresql.org/docs/7.4/static/app-initlocation.html and http://www.postgresql.org/docs/7.4/static/sql-createdatabase.html But my primary recommendation is to upgrade to AT LEAST 8.1 version of PostgreSQL. Now that 8.2.2 is out, I'd consider going to it. 7.4 is getting pretty long in the tooth by comparison.