Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
50b5d4bf
Commit
50b5d4bf
authored
Apr 11, 2002
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add mention of function CREATE INDEX usage.
parent
0c9790e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
39 deletions
+41
-39
doc/src/sgml/ref/create_index.sgml
doc/src/sgml/ref/create_index.sgml
+32
-30
src/backend/commands/command.c
src/backend/commands/command.c
+9
-9
No files found.
doc/src/sgml/ref/create_index.sgml
View file @
50b5d4bf
<!--
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_index.sgml,v 1.2
7 2002/03/22 19:20:38 petere
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_index.sgml,v 1.2
8 2002/04/11 23:20:04 momjian
Exp $
PostgreSQL documentation
PostgreSQL documentation
-->
-->
...
@@ -76,9 +76,10 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
...
@@ -76,9 +76,10 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
<term><replaceable class="parameter">acc_method</replaceable></term>
<term><replaceable class="parameter">acc_method</replaceable></term>
<listitem>
<listitem>
<para>
<para>
The name of the access method to be used for
The name of the access method to be used for the index. The
the index. The default access method is <literal>BTREE</literal>.
default access method is <literal>BTREE</literal>.
<application>PostgreSQL</application> provides four access methods for indexes:
<application>PostgreSQL</application> provides four access
methods for indexes:
<variablelist>
<variablelist>
<varlistentry>
<varlistentry>
...
@@ -225,26 +226,27 @@ ERROR: Cannot create index: 'index_name' already exists.
...
@@ -225,26 +226,27 @@ ERROR: Cannot create index: 'index_name' already exists.
</para>
</para>
<para>
<para>
In the second syntax shown above, an index is defined
In the second syntax shown above, an index is defined on the result
on the result of a user-specified function
of a user-specified function <replaceable
<replaceable class="parameter">func_name</replaceable> applied
class="parameter">func_name</replaceable> applied to one or more
to one or more columns of a single table.
columns of a single table. These <firstterm>functional
These <firstterm>functional indexes</firstterm>
indexes</firstterm> can be used to obtain fast access to data based
can be used to obtain fast access to data
on operators that would normally require some transformation to apply
based on operators that would normally require some
them to the base data. For example, a functional index on
transformation to apply them to the base data.
<literal>upper(col)</> would allow the clause
<literal>WHERE upper(col) = 'JIM'</> to use an index.
</para>
</para>
<para>
<para>
<application>PostgreSQL</application> provides B-tree, R-tree, hash,
and GiST access methods for
<application>PostgreSQL</application> provides B-tree, R-tree, hash,
indexes. The B-tree access method is an implementation of
and GiST access methods for indexes. The B-tree access method is an
Lehman-Yao high-concurrency B-trees. The R-tree access method
implementation of Lehman-Yao high-concurrency B-trees. The R-tree
implements standard R-trees using Guttman's quadratic split algorithm.
access method implements standard R-trees using Guttman's quadratic
The hash access method is an implementation of Litwin's linear
split algorithm. The hash access method is an implementation of
hashing. We mention the algorithms used solely to indicate that all
Litwin's linear hashing. We mention the algorithms used solely to
of these access methods are fully dynamic and do not have to be
indicate that all of these access methods are fully dynamic and do
optimized periodically (as is the case with, for example, static hash
not have to be optimized periodically (as is the case with, for
access methods).
example, static hash
access methods).
</para>
</para>
<para>
<para>
...
@@ -338,18 +340,18 @@ ERROR: Cannot create index: 'index_name' already exists.
...
@@ -338,18 +340,18 @@ ERROR: Cannot create index: 'index_name' already exists.
<para>
<para>
An <firstterm>operator class</firstterm> can be specified for each
An <firstterm>operator class</firstterm> can be specified for each
column of an index.
The operator class identifies the operators to
column of an index.
The operator class identifies the operators to be
be used by the index for that column.
For example, a B-tree index on
used by the index for that column.
For example, a B-tree index on
four-byte integers would use the <literal>int4_ops</literal> class;
four-byte integers would use the <literal>int4_ops</literal> class;
this operator class includes comparison functions for four-byte
this operator class includes comparison functions for four-byte
integers.
In practice the default operator class for the field's
integers.
In practice the default operator class for the field's data
data type is usually sufficient.
The main point of having operator classes
type is usually sufficient.
The main point of having operator classes
is that for some data types, there could be more than one meaningful
is that for some data types, there could be more than one meaningful
ordering.
For example, we might want to sort a complex-number data type
ordering.
For example, we might want to sort a complex-number data
either by absolute value or by real part. We could do this by defining
type either by absolute value or by real part. We could do this by
two operator classes for the data type and then selecting the proper
defining two operator classes for the data type and then selecting
class when making an index. There are also some operator classes with
the proper class when making an index. There are also some operator
special purposes:
classes with
special purposes:
<itemizedlist>
<itemizedlist>
<listitem>
<listitem>
...
...
src/backend/commands/command.c
View file @
50b5d4bf
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.17
2 2002/04/02 08:51:50 inoue
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.17
3 2002/04/11 23:20:04 momjian
Exp $
*
*
* NOTES
* NOTES
* The PerformAddAttribute() code, like most of the relation
* The PerformAddAttribute() code, like most of the relation
...
@@ -604,10 +604,10 @@ AlterTableAlterColumnDropNotNull(Oid myrelid,
...
@@ -604,10 +604,10 @@ AlterTableAlterColumnDropNotNull(Oid myrelid,
elog
(
ERROR
,
"ALTER TABLE: Cannot alter system attribute
\"
%s
\"
"
,
elog
(
ERROR
,
"ALTER TABLE: Cannot alter system attribute
\"
%s
\"
"
,
colName
);
colName
);
/*
/*
* Check that the attribute is not in a primary key
* Check that the attribute is not in a primary key
*/
*/
/* Loop over all indices on the relation */
/* Loop over all indices on the relation */
indexoidlist
=
RelationGetIndexList
(
rel
);
indexoidlist
=
RelationGetIndexList
(
rel
);
...
@@ -986,9 +986,9 @@ AlterTableAlterColumnFlags(Oid myrelid,
...
@@ -986,9 +986,9 @@ AlterTableAlterColumnFlags(Oid myrelid,
elog
(
ERROR
,
"ALTER TABLE: relation
\"
%s
\"
is not a table"
,
elog
(
ERROR
,
"ALTER TABLE: relation
\"
%s
\"
is not a table"
,
RelationGetRelationName
(
rel
));
RelationGetRelationName
(
rel
));
/*
/*
* we allow statistics case for system tables
* we allow statistics case for system tables
*/
*/
if
(
*
flagType
!=
'S'
&&
if
(
*
flagType
!=
'S'
&&
!
allowSystemTableMods
!
allowSystemTableMods
&&
IsSystemRelationName
(
RelationGetRelationName
(
rel
)))
&&
IsSystemRelationName
(
RelationGetRelationName
(
rel
)))
...
@@ -1911,7 +1911,7 @@ LockTableCommand(LockStmt *lockstmt)
...
@@ -1911,7 +1911,7 @@ LockTableCommand(LockStmt *lockstmt)
/*
/*
* CREATE SCHEMA
* CREATE SCHEMA
*/
*/
void
void
CreateSchemaCommand
(
CreateSchemaStmt
*
stmt
)
CreateSchemaCommand
(
CreateSchemaStmt
*
stmt
)
{
{
const
char
*
schemaName
=
stmt
->
schemaname
;
const
char
*
schemaName
=
stmt
->
schemaname
;
...
@@ -1976,13 +1976,13 @@ CreateSchemaCommand(CreateSchemaStmt *stmt)
...
@@ -1976,13 +1976,13 @@ CreateSchemaCommand(CreateSchemaStmt *stmt)
Node
*
parsetree
=
(
Node
*
)
lfirst
(
parsetree_item
);
Node
*
parsetree
=
(
Node
*
)
lfirst
(
parsetree_item
);
List
*
querytree_list
,
List
*
querytree_list
,
*
querytree_item
;
*
querytree_item
;
querytree_list
=
parse_analyze
(
parsetree
,
NULL
);
querytree_list
=
parse_analyze
(
parsetree
,
NULL
);
foreach
(
querytree_item
,
querytree_list
)
foreach
(
querytree_item
,
querytree_list
)
{
{
Query
*
querytree
=
(
Query
*
)
lfirst
(
querytree_item
);
Query
*
querytree
=
(
Query
*
)
lfirst
(
querytree_item
);
/* schemas should contain only utility stmts */
/* schemas should contain only utility stmts */
Assert
(
querytree
->
commandType
==
CMD_UTILITY
);
Assert
(
querytree
->
commandType
==
CMD_UTILITY
);
/* do this step */
/* do this step */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment