Create Index
Places an index on a table.
Synopsis
CREATE [ UNIQUE ] INDEX index_name ON table [ USING method ] ( column [ op_class ] [, ...] ) CREATE [ UNIQUE ] INDEX index_name ON table [ USING method ] ( func_name ( column [, ... ] ) [ op_class ] )
Parameters
UNIQUEThe optional
UNIQUEkeyword. When used, this causes the database to check for, and prevent, duplicate values within the column (or combined columns) it is placed upon. This check will occur both when the index is created and each time data is added to the table. PostgreSQL will then generate an error whenever anINSERTorUPDATErequest is made that would place duplicate data within the index, and the command will fail.index_nameThe name for the new index.
tableThe name of the table you are placing the index on.
methodThe type of indexing method you wish to use for the index. There are three methods available to choose from, the default being
btree:btreeThe PostgreSQL implementation of Lehman-Yao high-concurrency B-trees.
rtreeThe PostgreSQL implementation of standard R-trees using Guttman’s quadratic split algorithm.
hashThe PostgreSQL implementation of Litwin’s linear hashing.
columnThe name of the column (or comma-delimited list of columns) on which to place the index.
op_classThe optionally specified associated operator class. For most users, this should not be specified.
func_nameThe name of a function you wish
CREATE INDEXto use on the specified columns (rather than indexing the data values literally in those columns). ...