1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-16 06:01:02 +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:
Tom Lane
2002-08-05 03:29:17 +00:00
parent 07f9682de4
commit 15fe086fba
29 changed files with 288 additions and 851 deletions

View File

@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.97 2002/07/20 05:16:57 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.98 2002/08/05 03:29:16 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -347,19 +347,8 @@ createdb(const CreatedbStmt *stmt)
simple_heap_insert(pg_database_rel, tuple);
/*
* Update indexes
*/
if (RelationGetForm(pg_database_rel)->relhasindex)
{
Relation idescs[Num_pg_database_indices];
CatalogOpenIndices(Num_pg_database_indices,
Name_pg_database_indices, idescs);
CatalogIndexInsert(idescs, Num_pg_database_indices, pg_database_rel,
tuple);
CatalogCloseIndices(Num_pg_database_indices, idescs);
}
/* Update indexes */
CatalogUpdateIndexes(pg_database_rel, tuple);
/* Close pg_database, but keep lock till commit */
heap_close(pg_database_rel, NoLock);
@ -562,19 +551,8 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt)
newtuple = heap_modifytuple(tuple, rel, repl_val, repl_null, repl_repl);
simple_heap_update(rel, &tuple->t_self, newtuple);
/*
* Update indexes
*/
if (RelationGetForm(rel)->relhasindex)
{
Relation idescs[Num_pg_database_indices];
CatalogOpenIndices(Num_pg_database_indices,
Name_pg_database_indices, idescs);
CatalogIndexInsert(idescs, Num_pg_database_indices, rel,
newtuple);
CatalogCloseIndices(Num_pg_database_indices, idescs);
}
/* Update indexes */
CatalogUpdateIndexes(rel, newtuple);
heap_endscan(scan);
heap_close(rel, RowExclusiveLock);