Web design careers - 602 CHAPTER 26 POSTGRESQL ADMINISTRATION Altering a
602 CHAPTER 26 POSTGRESQL ADMINISTRATION Altering a Tablespace The ALTER TABLESPACE command allows us to change the name or owner of the tablespace. The command takes one of two forms. The first form renames a current tablespace to a new name: ALTER TABLESPACE tablespacename RENAME TO newtablespacename; The second form changes the owner of a tablespace to a new owner: ALTER TABLESPACE tablespacename OWNER TO newowner; Note that this does not change the ownership of the objects within that tablespace. Dropping a Tablespace Of course, from time to time, we may want to drop a tablespace that we have created. This is accomplished simply enough with the DROP TABLESPACE command: DROP TABLESPACE tablespacename; Note that all objects within a tablespace must first be deleted separately or the DROP TABLESPACE command will fail. Vacuum and Analyze Compared to most database systems, PostgreSQL is a relatively low-maintenance database system. However, PostgreSQL does have a few tasks that need to be run regularly, whether manually, through automated system tools, or via some other means. These two tasks are periodic vacuuming and analyzing of your tables. This section explains why we need to run these processes and introduces the commands involved in doing so. Vacuum PostgreSQL employs a Multiversion Concurrency Control (MVCC) system to handle highly concurrent loads without locking. One aspect of an MVCC system is that multiple versions of a given row may exist within a table at any given time; this may happen if, for example, one user is selecting a row while another is updating that row. While this is good for high concurrency, at some point these multiple row versions must be resolved. That point is at transaction commit, which is when the server looks at any versions of a row that are no longer valid and marks them as such, a condition referred to as being a dead tuple. In an MVCC system, these dead tuples must be removed at some point, because otherwise they lead to wasted disk space and can slow down subsequent queries. Some database systems choose to do this housecleaning at transaction commit time, scanning in-progress transactions and moving records around on disk as needed. Rather than put this work in the critical path of running transactions, PostgreSQL leaves this work to be done by a background process, which can be scheduled in a fashion that incurs minimal impact on the mainline system. This background process is handled by PostgreSQL s VACUUM command. The syntax for VACUUM is simple enough: VACUUM [FULL | FREEZE] [VERBOSE] [ANALYZE] [ table [column]];
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.