This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
ramfs_based_table_space [2012/03/23 19:39] k2patel |
ramfs_based_table_space [2012/03/23 19:41] k2patel [Setting up a tablespace] |
||
---|---|---|---|
Line 8: | Line 8: | ||
- | Tablespaces in PostgreSQL allow database administrators to define locations in the file system where the files \\ | + | Tablespaces in PostgreSQL allow database administrators to define locations in the file system where the files \\ |
- | representing database objects can be stored. Once created, a tablespace can be referred to by name when creating \\ | + | representing database objects can be stored. Once created, a tablespace can be referred to by name when creating \\ |
- | database objects.The location must be an existing, empty directory that is owned by the PostgreSQL system user. \\ | + | database objects.The location must be an existing, empty directory that is owned by the PostgreSQL system user. \\ |
- | All objects subsequently created within the tablespace will be stored in files underneath this directory. \\ | + | All objects subsequently created within the tablespace will be stored in files underneath this directory. \\ |
- | Creation of the tablespace itself must be done as a database superuser, but after that you can allow ordinary \\ | + | Creation of the tablespace itself must be done as a database superuser, but after that you can allow ordinary \\ |
- | database users to make use of it. To do that, grant them the CREATE privilege on it. | + | database users to make use of it. To do that, grant them the CREATE privilege on it. |
First create the directory where tablespace will be stored. It must reside on your ramfs filesystem. | First create the directory where tablespace will be stored. It must reside on your ramfs filesystem. | ||
Line 79: | Line 79: | ||
- | == Dump database schema: == | + | == Dump database schema: == |
<code bash> | <code bash> | ||
- | pg_dump --create --schema-only --file=/root/memdb.sql --host=localhost -U postgres memdb | + | pg_dump --create --schema-only --file=/root/memdb.sql --host=localhost -U postgres memdb |
</code> | </code> | ||
- | Stop postmaster (original init code) | + | Stop postmaster (original init code) |
- | Unmount ramfs: | + | == Unmount ramfs: == |
- | + | | |
<code bash> | <code bash> | ||
umount /mnt/ramfs | umount /mnt/ramfs | ||
Line 95: | Line 95: | ||
- | == Mount ramfs: == | + | == Mount ramfs: == |
Line 105: | Line 105: | ||
</code> | </code> | ||
- | == Recreate PostgreSQL tablespace directory: == | + | == Recreate PostgreSQL tablespace directory: == |
Line 116: | Line 116: | ||
- | == Start postmaster (original init code) == | + | == Start postmaster (original init code) == |
- | Drop the database because it exists in PostgreSQL system tables only. | + | Drop the database because it exists in PostgreSQL system tables only. |
<code bash> | <code bash> | ||
Line 124: | Line 124: | ||
</code> | </code> | ||
| | ||
- | == Restore the database schema: == | + | == Restore the database schema: == |
| |