mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
Restructure system-catalog index updating logic. Instead of having
hardwired lists of index names for each catalog, use the relcache's mechanism for caching lists of OIDs of indexes of any table. This reduces the common case of updating system catalog indexes to a single line, makes it much easier to add a new system index (in fact, you can now do so on-the-fly if you want to), and as a nice side benefit improves performance a little. Per recent pghackers discussion.
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/opclasscmds.c,v 1.2 2002/07/29 23:46:35 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/opclasscmds.c,v 1.3 2002/08/05 03:29:16 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -286,15 +286,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
|
||||
|
||||
opclassoid = simple_heap_insert(rel, tup);
|
||||
|
||||
if (RelationGetForm(rel)->relhasindex)
|
||||
{
|
||||
Relation idescs[Num_pg_opclass_indices];
|
||||
|
||||
CatalogOpenIndices(Num_pg_opclass_indices, Name_pg_opclass_indices,
|
||||
idescs);
|
||||
CatalogIndexInsert(idescs, Num_pg_opclass_indices, rel, tup);
|
||||
CatalogCloseIndices(Num_pg_opclass_indices, idescs);
|
||||
}
|
||||
CatalogUpdateIndexes(rel, tup);
|
||||
|
||||
heap_freetuple(tup);
|
||||
|
||||
@ -395,15 +387,8 @@ storeOperators(Oid opclassoid, int numOperators,
|
||||
|
||||
simple_heap_insert(rel, tup);
|
||||
|
||||
if (RelationGetForm(rel)->relhasindex)
|
||||
{
|
||||
Relation idescs[Num_pg_amop_indices];
|
||||
CatalogUpdateIndexes(rel, tup);
|
||||
|
||||
CatalogOpenIndices(Num_pg_amop_indices, Name_pg_amop_indices,
|
||||
idescs);
|
||||
CatalogIndexInsert(idescs, Num_pg_amop_indices, rel, tup);
|
||||
CatalogCloseIndices(Num_pg_amop_indices, idescs);
|
||||
}
|
||||
heap_freetuple(tup);
|
||||
}
|
||||
|
||||
@ -444,15 +429,8 @@ storeProcedures(Oid opclassoid, int numProcs, Oid *procedures)
|
||||
|
||||
simple_heap_insert(rel, tup);
|
||||
|
||||
if (RelationGetForm(rel)->relhasindex)
|
||||
{
|
||||
Relation idescs[Num_pg_amproc_indices];
|
||||
CatalogUpdateIndexes(rel, tup);
|
||||
|
||||
CatalogOpenIndices(Num_pg_amproc_indices, Name_pg_amproc_indices,
|
||||
idescs);
|
||||
CatalogIndexInsert(idescs, Num_pg_amproc_indices, rel, tup);
|
||||
CatalogCloseIndices(Num_pg_amproc_indices, idescs);
|
||||
}
|
||||
heap_freetuple(tup);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user