pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Moving a table to another directory
9+ messages / 4 participants
[nested] [flat]

* Moving a table to another directory
@ 2007-02-05 19:41  Ezequiel Luis Pellettieri <ezequiel.pellettieri@gmail.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Ezequiel Luis Pellettieri @ 2007-02-05 19:41 UTC (permalink / raw)
  To: pgsql-admin

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

thanks in advance!

pelle.-

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Moving a table to another directory
@ 2007-02-05 20:14  Milen A. Radev <milen@radev.net>
  parent: Ezequiel Luis Pellettieri <ezequiel.pellettieri@gmail.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Milen A. Radev @ 2007-02-05 20:14 UTC (permalink / raw)
  To: pgsql-admin

Ezequiel Luis Pellettieri написа:
> 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)


-- 
Milen A. Radev




^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Moving a table to another directory
@ 2007-02-06 02:26  Ezequiel Luis Pellettieri <ezequiel.pellettieri@gmail.com>
  parent: Milen A. Radev <milen@radev.net>
  0 siblings, 1 reply; 9+ messages in thread

From: Ezequiel Luis Pellettieri @ 2007-02-06 02:26 UTC (permalink / raw)
  To: Milen A. Radev <milen@radev.net>; pgsql-admin

Thanks Milen, does it work on 7.4??

pelle.-


2007/2/5, Milen A. Radev <milen@radev.net>:
>
> Ezequiel Luis Pellettieri написа:
> > 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)
>
>
> --
> Milen A. Radev
>


^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Moving a table to another directory
@ 2007-02-06 03:03  Jaime Casanova <systemguards@gmail.com>
  parent: Ezequiel Luis Pellettieri <ezequiel.pellettieri@gmail.com>
  0 siblings, 2 replies; 9+ messages in thread

From: Jaime Casanova @ 2007-02-06 03:03 UTC (permalink / raw)
  To: Ezequiel Luis Pellettieri <ezequiel.pellettieri@gmail.com>; +Cc: Milen A. Radev <milen@radev.net>; pgsql-admin

> 2007/2/5, Milen A. Radev <milen@radev.net>:
> > Ezequiel Luis Pellettieri написа:
> > > 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 <ezequiel.pellettieri@gmail.com> wrote:
> Thanks Milen, does it work on 7.4??
>

oops... your symlink will be ok... use the contrib oid2name to
identify the files corresponding to that table... and maybe the
indexes as well...

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...

-- 
regards,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
                                       Richard Cook


^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Moving a table to another directory
@ 2007-02-06 03:28  Ezequiel Luis Pellettieri <ezequiel.pellettieri@gmail.com>
  parent: Jaime Casanova <systemguards@gmail.com>
  1 sibling, 1 reply; 9+ messages in thread

From: Ezequiel Luis Pellettieri @ 2007-02-06 03:28 UTC (permalink / raw)
  To: Jaime Casanova <systemguards@gmail.com>; +Cc: pgsql-admin

Jaime you mean that moving all table files and pointing the symlink to the
first one will work?
and doing the same with its index too...?

thanks for your help!

pelle.-


2007/2/6, Jaime Casanova <systemguards@gmail.com>:
>
> > 2007/2/5, Milen A. Radev <milen@radev.net>:
> > > Ezequiel Luis Pellettieri написа:
> > > > 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 <ezequiel.pellettieri@gmail.com>
> wrote:
> > Thanks Milen, does it work on 7.4??
> >
>
> oops... your symlink will be ok... use the contrib oid2name to
> identify the files corresponding to that table... and maybe the
> indexes as well...
>
> 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...
>
> --
> regards,
> Jaime Casanova
>
> "Programming today is a race between software engineers striving to
> build bigger and better idiot-proof programs and the universe trying
> to produce bigger and better idiots.
> So far, the universe is winning."
>                                        Richard Cook
>



-- 
Saludos cordiales. Ezequiel L. Pellettieri


^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Moving a table to another directory
@ 2007-02-06 03:33  Jaime Casanova <systemguards@gmail.com>
  parent: Ezequiel Luis Pellettieri <ezequiel.pellettieri@gmail.com>
  0 siblings, 0 replies; 9+ messages in thread

From: Jaime Casanova @ 2007-02-06 03:33 UTC (permalink / raw)
  To: Ezequiel Luis Pellettieri <ezequiel.pellettieri@gmail.com>; +Cc: pgsql-admin

On 2/5/07, Ezequiel Luis Pellettieri <ezequiel.pellettieri@gmail.com> wrote:
> Jaime you mean that moving all table files and pointing the symlink to the
> first one will work?
> and doing the same with its index too...?
>

no, IIRC, you need a symlink per table's file, the same for index's files...
you shoukd think in upgrading... ;)

-- 
regards,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
                                       Richard Cook



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Moving a table to another directory
@ 2007-02-06 15:44  Scott Marlowe <smarlowe@g2switchworks.com>
  parent: Jaime Casanova <systemguards@gmail.com>
  1 sibling, 1 reply; 9+ messages in thread

From: Scott Marlowe @ 2007-02-06 15:44 UTC (permalink / raw)
  To: Jaime Casanova <systemguards@gmail.com>; +Cc: Ezequiel Luis Pellettieri <ezequiel.pellettieri@gmail.com>; Milen A. Radev <milen@radev.net>; pgsql-admin

On Mon, 2007-02-05 at 21:03, Jaime Casanova wrote:
> > 2007/2/5, Milen A. Radev <milen@radev.net>:
> > > Ezequiel Luis Pellettieri написа:
> > > > 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 <ezequiel.pellettieri@gmail.com> wrote:
> > Thanks Milen, does it work on 7.4??
> >
> 
> oops... your symlink will be ok... use the contrib oid2name to
> identify the files corresponding to that table... and maybe the
> indexes as well...
> 
> 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 
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.



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Moving a table to another directory
@ 2007-02-07 16:27  Ezequiel Luis Pellettieri <ezequiel.pellettieri@gmail.com>
  parent: Scott Marlowe <smarlowe@g2switchworks.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Ezequiel Luis Pellettieri @ 2007-02-07 16:27 UTC (permalink / raw)
  To: Scott Marlowe <smarlowe@g2switchworks.com>; +Cc: Jaime Casanova <systemguards@gmail.com>; Milen A. Radev <milen@radev.net>; pgsql-admin

thanks guys, is it possible to go with it, without stopping the postmaster?
maybe just rejecting conns to the DB...
this is cos I had another DB's running...

thanks again.

pelle.-

2007/2/6, Scott Marlowe <smarlowe@g2switchworks.com>:
>
> On Mon, 2007-02-05 at 21:03, Jaime Casanova wrote:
> > > 2007/2/5, Milen A. Radev <milen@radev.net>:
> > > > Ezequiel Luis Pellettieri написа:
> > > > > 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 <ezequiel.pellettieri@gmail.com>
> wrote:
> > > Thanks Milen, does it work on 7.4??
> > >
> >
> > oops... your symlink will be ok... use the contrib oid2name to
> > identify the files corresponding to that table... and maybe the
> > indexes as well...
> >
> > 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
> 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.
>



-- 
Saludos cordiales. Ezequiel L. Pellettieri


^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Moving a table to another directory
@ 2007-02-08 01:44  Jaime Casanova <systemguards@gmail.com>
  parent: Ezequiel Luis Pellettieri <ezequiel.pellettieri@gmail.com>
  0 siblings, 0 replies; 9+ messages in thread

From: Jaime Casanova @ 2007-02-08 01:44 UTC (permalink / raw)
  To: Ezequiel Luis Pellettieri <ezequiel.pellettieri@gmail.com>; +Cc: Scott Marlowe <smarlowe@g2switchworks.com>; Milen A. Radev <milen@radev.net>; pgsql-admin

On 2/7/07, Ezequiel Luis Pellettieri <ezequiel.pellettieri@gmail.com> wrote:
> thanks guys, is it possible to go with it, without stopping the postmaster?
> maybe just rejecting conns to the DB...
> this is cos I had another DB's running...
>
> thanks again.
>

AFAIR, no

-- 
regards,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
                                       Richard Cook



^ permalink  raw  reply  [nested|flat] 9+ messages in thread


end of thread, other threads:[~2007-02-08 01:44 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-02-05 19:41 Moving a table to another directory Ezequiel Luis Pellettieri <ezequiel.pellettieri@gmail.com>
2007-02-05 20:14 ` Milen A. Radev <milen@radev.net>
2007-02-06 02:26   ` Ezequiel Luis Pellettieri <ezequiel.pellettieri@gmail.com>
2007-02-06 03:03     ` Jaime Casanova <systemguards@gmail.com>
2007-02-06 03:28       ` Ezequiel Luis Pellettieri <ezequiel.pellettieri@gmail.com>
2007-02-06 03:33         ` Jaime Casanova <systemguards@gmail.com>
2007-02-06 15:44       ` Scott Marlowe <smarlowe@g2switchworks.com>
2007-02-07 16:27         ` Ezequiel Luis Pellettieri <ezequiel.pellettieri@gmail.com>
2007-02-08 01:44           ` Jaime Casanova <systemguards@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox