diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-08-05 03:29:17 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-08-05 03:29:17 +0000 |
commit | 15fe086fba52bbac7560151e06d1efb3daa69e4a (patch) | |
tree | f4213b8a0a5f0be0a4b3c990b5063b800961551f /src/backend/commands/dbcommands.c | |
parent | 07f9682de43ce53fcd6d86744f610cacfabc60bb (diff) | |
download | postgresql-15fe086fba52bbac7560151e06d1efb3daa69e4a.tar.gz postgresql-15fe086fba52bbac7560151e06d1efb3daa69e4a.zip |
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.
Diffstat (limited to 'src/backend/commands/dbcommands.c')
-rw-r--r-- | src/backend/commands/dbcommands.c | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index 2c401a6dbdc..d043d95b784 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -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); |