?
本文檔使用 php中文網(wǎng)手冊(cè) 發(fā)布
ALTER INDEX name RENAME TO new_name ALTER INDEX name SET TABLESPACE tablespace_name ALTER INDEX name SET ( storage_parameter = value [, ... ] ) ALTER INDEX name RESET ( storage_parameter [, ... ] )
ALTER INDEX改變一個(gè)現(xiàn)有索引的定義。它有幾種子形式:
The RENAME form changes the name of the index. There is no effect on the stored data.
RENAME只改變索引的名字。對(duì)存儲(chǔ)的數(shù)據(jù)沒有影響。
This form changes the index's tablespace to the specified tablespace and moves the data file(s) associated with the index to the new tablespace. See also CREATE TABLESPACE.
改變索引的表空間為指定表空間,并且把索引相關(guān)的數(shù)據(jù)文件移動(dòng)到新的表空間里。又見CREATE TABLESPACE。
This form changes one or more index-method-specific storage parameters for the index. See CREATE INDEX for details on the available parameters. Note that the index contents will not be modified immediately by this command; depending on the parameter you might need to rebuild the index with REINDEX to get the desired effects.
改變索引的一個(gè)或多個(gè)索引方法特定的存儲(chǔ)參數(shù)。參見CREATE INDEX獲取可用參數(shù)的細(xì)節(jié)。 需要注意的是索引內(nèi)容不會(huì)被這個(gè)命令立即修改,根據(jù)參數(shù)的不同, 你可能需要使用REINDEX重建索引來獲得期望的效果。
重置索引的一個(gè)或多個(gè)索引方法特定的存儲(chǔ)參數(shù)為缺省值。 與 SET一樣,可能需要使用REINDEX來完全更新索引。
The name (possibly schema-qualified) of an existing index to alter.
要修改的索引的名字(可以有模式修飾)。
The new name for the index.
索引的新名字
索引將移動(dòng)到的表空間的名字。
索引方法特定的存儲(chǔ)參數(shù)的名字。
The new value for an index-method-specific storage parameter. This might be a number or a word depending on the parameter.
引方法特定的存儲(chǔ)參數(shù)的新值。根據(jù)參數(shù)的不同,這可能是一個(gè)數(shù)字或單詞。
這些操作也可以用ALTER TABLE進(jìn)行。 ALTER INDEX實(shí)際上只是ALTER TABLE 用于索引的形式的一個(gè)別名。
There was formerly an ALTER INDEX OWNER variant, but this is now ignored (with a warning). An index cannot have an owner different from its table's owner. Changing the table's owner automatically changes the index as well.
以前還有一個(gè)ALTER INDEX OWNER變種,但是現(xiàn)在忽略了(帶一個(gè)警告)。 一個(gè)索引不能有一個(gè)和其表的屬主不同的所有者。改變?cè)摫淼乃姓邔⒆詣?dòng)改變索引的所有者。
不允許修改系統(tǒng)表索引的任何部分。
重命名一個(gè)現(xiàn)有的索引:
ALTER INDEX distributors RENAME TO suppliers;
把一個(gè)索引移動(dòng)到另外一個(gè)表空間:
ALTER INDEX distributors SET TABLESPACE fasttablespace;
改變索引的占位因數(shù)(假定該索引方法支持它):
ALTER INDEX distributors SET (fillfactor = 75); REINDEX INDEX distributors;
ALTER INDEX是PostgreSQL擴(kuò)展。