diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-08-25 04:06:58 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-08-25 04:06:58 +0000 |
| commit | e093dcdd2853911ca1ad710581182dfcb6c78ea3 (patch) | |
| tree | 59fc44746f9937abea6ad44e2098a8c3c4b7f7e6 /src/include | |
| parent | 8f91e2b6071aaeae333f668d0f5d9189c5710a7a (diff) | |
| download | postgresql-e093dcdd2853911ca1ad710581182dfcb6c78ea3.tar.gz | |
Add the ability to create indexes 'concurrently', that is, without
blocking concurrent writes to the table. Greg Stark, with a little help
from Tom Lane.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/catalog/catversion.h | 4 | ||||
| -rw-r--r-- | src/include/catalog/index.h | 7 | ||||
| -rw-r--r-- | src/include/catalog/pg_attribute.h | 11 | ||||
| -rw-r--r-- | src/include/catalog/pg_index.h | 14 | ||||
| -rw-r--r-- | src/include/commands/defrem.h | 5 | ||||
| -rw-r--r-- | src/include/nodes/execnodes.h | 4 | ||||
| -rw-r--r-- | src/include/nodes/parsenodes.h | 3 | ||||
| -rw-r--r-- | src/include/storage/itemptr.h | 3 |
8 files changed, 31 insertions, 20 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 448f9e4ecf..6266b591ca 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -37,7 +37,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.352 2006/08/21 00:57:26 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.353 2006/08/25 04:06:54 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 200608191 +#define CATALOG_VERSION_NO 200608211 #endif diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h index f54508fb5b..881ef90279 100644 --- a/src/include/catalog/index.h +++ b/src/include/catalog/index.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/index.h,v 1.70 2006/07/31 01:16:37 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/index.h,v 1.71 2006/08/25 04:06:55 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -39,7 +39,8 @@ extern Oid index_create(Oid heapRelationId, bool isprimary, bool isconstraint, bool allow_system_table_mods, - bool skip_build); + bool skip_build, + bool concurrent); extern void index_drop(Oid indexId); @@ -64,6 +65,8 @@ extern double IndexBuildHeapScan(Relation heapRelation, IndexBuildCallback callback, void *callback_state); +extern void validate_index(Oid heapId, Oid indexId, Snapshot snapshot); + extern void reindex_index(Oid indexId); extern bool reindex_relation(Oid relid, bool toast_too); diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h index e098079b93..68d7eae7ab 100644 --- a/src/include/catalog/pg_attribute.h +++ b/src/include/catalog/pg_attribute.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_attribute.h,v 1.123 2006/07/10 16:20:51 alvherre Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_attribute.h,v 1.124 2006/08/25 04:06:55 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -460,9 +460,10 @@ DATA(insert ( 1259 tableoid 26 0 4 -7 0 -1 -1 t p i t f f t 0)); { 0, {"indisunique"}, 16, -1, 1, 4, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \ { 0, {"indisprimary"}, 16, -1, 1, 5, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \ { 0, {"indisclustered"}, 16, -1, 1, 6, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \ -{ 0, {"indkey"}, 22, -1, -1, 7, 1, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \ -{ 0, {"indclass"}, 30, -1, -1, 8, 1, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \ -{ 0, {"indexprs"}, 25, -1, -1, 9, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0 }, \ -{ 0, {"indpred"}, 25, -1, -1, 10, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0 } +{ 0, {"indisvalid"}, 16, -1, 1, 7, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \ +{ 0, {"indkey"}, 22, -1, -1, 8, 1, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \ +{ 0, {"indclass"}, 30, -1, -1, 9, 1, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \ +{ 0, {"indexprs"}, 25, -1, -1, 10, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0 }, \ +{ 0, {"indpred"}, 25, -1, -1, 11, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0 } #endif /* PG_ATTRIBUTE_H */ diff --git a/src/include/catalog/pg_index.h b/src/include/catalog/pg_index.h index bc7026cc25..506fbc293d 100644 --- a/src/include/catalog/pg_index.h +++ b/src/include/catalog/pg_index.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_index.h,v 1.39 2006/03/05 15:58:54 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_index.h,v 1.40 2006/08/25 04:06:55 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -41,6 +41,7 @@ CATALOG(pg_index,2610) BKI_WITHOUT_OIDS bool indisunique; /* is this a unique index? */ bool indisprimary; /* is this index for primary key? */ bool indisclustered; /* is this the index last clustered by? */ + bool indisvalid; /* is this index valid for use by queries? */ /* VARIABLE LENGTH FIELDS: */ int2vector indkey; /* column numbers of indexed cols, or 0 */ @@ -63,16 +64,17 @@ typedef FormData_pg_index *Form_pg_index; * compiler constants for pg_index * ---------------- */ -#define Natts_pg_index 10 +#define Natts_pg_index 11 #define Anum_pg_index_indexrelid 1 #define Anum_pg_index_indrelid 2 #define Anum_pg_index_indnatts 3 #define Anum_pg_index_indisunique 4 #define Anum_pg_index_indisprimary 5 #define Anum_pg_index_indisclustered 6 -#define Anum_pg_index_indkey 7 -#define Anum_pg_index_indclass 8 -#define Anum_pg_index_indexprs 9 -#define Anum_pg_index_indpred 10 +#define Anum_pg_index_indisvalid 7 +#define Anum_pg_index_indkey 8 +#define Anum_pg_index_indclass 9 +#define Anum_pg_index_indexprs 10 +#define Anum_pg_index_indpred 11 #endif /* PG_INDEX_H */ diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h index 902931d02a..26983fc198 100644 --- a/src/include/commands/defrem.h +++ b/src/include/commands/defrem.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/defrem.h,v 1.75 2006/07/18 17:42:01 momjian Exp $ + * $PostgreSQL: pgsql/src/include/commands/defrem.h,v 1.76 2006/08/25 04:06:55 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -33,7 +33,8 @@ extern void DefineIndex(RangeVar *heapRelation, bool is_alter_table, bool check_rights, bool skip_build, - bool quiet); + bool quiet, + bool concurrent); extern void RemoveIndex(RangeVar *relation, DropBehavior behavior); extern void ReindexIndex(RangeVar *indexRelation); extern void ReindexTable(RangeVar *relation); diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 47b7c01f23..35ee8a20d0 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.159 2006/08/12 02:52:06 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.160 2006/08/25 04:06:56 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -37,6 +37,7 @@ * Predicate partial-index predicate, or NIL if none * PredicateState exec state for predicate, or NIL if none * Unique is it a unique index? + * Concurrent are we doing a concurrent index build? * ---------------- */ typedef struct IndexInfo @@ -49,6 +50,7 @@ typedef struct IndexInfo List *ii_Predicate; /* list of Expr */ List *ii_PredicateState; /* list of ExprState */ bool ii_Unique; + bool ii_Concurrent; } IndexInfo; /* ---------------- diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index a3ae58d17b..7aa7bfd38e 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.324 2006/08/21 00:57:26 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.325 2006/08/25 04:06:56 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1463,6 +1463,7 @@ typedef struct IndexStmt bool unique; /* is index unique? */ bool primary; /* is index on primary key? */ bool isconstraint; /* is it from a CONSTRAINT clause? */ + bool concurrent; /* should this be a concurrent index build? */ } IndexStmt; /* ---------------------- diff --git a/src/include/storage/itemptr.h b/src/include/storage/itemptr.h index c6eaaf1911..b558eb33eb 100644 --- a/src/include/storage/itemptr.h +++ b/src/include/storage/itemptr.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/itemptr.h,v 1.28 2006/03/05 15:58:59 momjian Exp $ + * $PostgreSQL: pgsql/src/include/storage/itemptr.h,v 1.29 2006/08/25 04:06:57 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -141,5 +141,6 @@ typedef ItemPointerData *ItemPointer; */ extern bool ItemPointerEquals(ItemPointer pointer1, ItemPointer pointer2); +extern int32 ItemPointerCompare(ItemPointer arg1, ItemPointer arg2); #endif /* ITEMPTR_H */ |
