This is a discussion on Moving a table to another directory within the pgsql Admins forums, part of the PostgreSQL category; --> Hi guys I have a big table (25 gb) and a need to move it to another directory cos ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| 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/curre...lespace.html); 2. ALTER TABLE big_table SET TABLESPACE xxx; (http://www.postgresql.org/docs/curre...ltertable.html) -- Milen A. Radev ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend |
| |||
| > 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/curre...lespace.html); > > > > 2. ALTER TABLE big_table SET TABLESPACE xxx; > > > (http://www.postgresql.org/docs/curre...ltertable.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 ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster |
| |||
| 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 ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match |
| |||
| 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/curre...lespace.html); > > > > > > 2. ALTER TABLE big_table SET TABLESPACE xxx; > > > > > (http://www.postgresql.org/docs/curre...ltertable.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/s...tlocation.html and http://www.postgresql.org/docs/7.4/s...edatabase.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. ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org |
| ||||
| 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 ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly |