summaryrefslogtreecommitdiff
path: root/src/backend/storage
diff options
context:
space:
mode:
authorTom Lane2002-08-05 03:29:17 +0000
committerTom Lane2002-08-05 03:29:17 +0000
commit15fe086fba52bbac7560151e06d1efb3daa69e4a (patch)
treef4213b8a0a5f0be0a4b3c990b5063b800961551f /src/backend/storage
parent07f9682de43ce53fcd6d86744f610cacfabc60bb (diff)
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/storage')
-rw-r--r--src/backend/storage/large_object/inv_api.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/backend/storage/large_object/inv_api.c b/src/backend/storage/large_object/inv_api.c
index 0e279eed3d2..5279190000a 100644
--- a/src/backend/storage/large_object/inv_api.c
+++ b/src/backend/storage/large_object/inv_api.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.93 2002/06/20 20:29:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.94 2002/08/05 03:29:17 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -404,8 +404,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
Datum values[Natts_pg_largeobject];
char nulls[Natts_pg_largeobject];
char replace[Natts_pg_largeobject];
- bool write_indices;
- Relation idescs[Num_pg_largeobject_indices];
+ CatalogIndexState indstate;
Assert(PointerIsValid(obj_desc));
Assert(buf != NULL);
@@ -413,11 +412,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
if (nbytes <= 0)
return 0;
- write_indices = !IsIgnoringSystemIndexes();
- if (write_indices)
- CatalogOpenIndices(Num_pg_largeobject_indices,
- Name_pg_largeobject_indices,
- idescs);
+ indstate = CatalogOpenIndexes(obj_desc->heap_r);
ScanKeyEntryInitialize(&skey[0],
(bits16) 0x0,
@@ -511,9 +506,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
newtup = heap_modifytuple(oldtuple, obj_desc->heap_r,
values, nulls, replace);
simple_heap_update(obj_desc->heap_r, &newtup->t_self, newtup);
- if (write_indices)
- CatalogIndexInsert(idescs, Num_pg_largeobject_indices,
- obj_desc->heap_r, newtup);
+ CatalogIndexInsert(indstate, newtup);
heap_freetuple(newtup);
/*
@@ -556,9 +549,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
values[Anum_pg_largeobject_data - 1] = PointerGetDatum(&workbuf);
newtup = heap_formtuple(obj_desc->heap_r->rd_att, values, nulls);
simple_heap_insert(obj_desc->heap_r, newtup);
- if (write_indices)
- CatalogIndexInsert(idescs, Num_pg_largeobject_indices,
- obj_desc->heap_r, newtup);
+ CatalogIndexInsert(indstate, newtup);
heap_freetuple(newtup);
}
pageno++;
@@ -566,8 +557,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
index_endscan(sd);
- if (write_indices)
- CatalogCloseIndices(Num_pg_largeobject_indices, idescs);
+ CatalogCloseIndexes(indstate);
/*
* Advance command counter so that my tuple updates will be seen by