diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-05-24 18:57:57 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-05-24 18:57:57 +0000 |
commit | 3f4d48802271126b1343289a9d2267ff1ed3788a (patch) | |
tree | b8c7507719ba240834e28cfbb56e2badff118b7e /src/backend/commands/trigger.c | |
parent | 2f2d05763d1c55c7998c0d7030659e3db6f60183 (diff) | |
download | postgresql-3f4d48802271126b1343289a9d2267ff1ed3788a.tar.gz postgresql-3f4d48802271126b1343289a9d2267ff1ed3788a.zip |
Mark index entries "killed" when they are no longer visible to any
transaction, so as to avoid returning them out of the index AM. Saves
repeated heap_fetch operations on frequently-updated rows. Also detect
queries on unique keys (equality to all columns of a unique index), and
don't bother continuing scan once we have found first match.
Killing is implemented in the btree and hash AMs, but not yet in rtree
or gist, because there isn't an equally convenient place to do it in
those AMs (the outer amgetnext routine can't do it without re-pinning
the index page).
Did some small cleanup on APIs of HeapTupleSatisfies, heap_fetch, and
index_insert to make this a little easier.
Diffstat (limited to 'src/backend/commands/trigger.c')
-rw-r--r-- | src/backend/commands/trigger.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index e0b01b6fee5..2cb5f2e4574 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.118 2002/05/21 22:05:54 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.119 2002/05/24 18:57:55 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1421,16 +1421,14 @@ DeferredTriggerExecute(DeferredTriggerEvent event, int itemno, if (ItemPointerIsValid(&(event->dte_oldctid))) { ItemPointerCopy(&(event->dte_oldctid), &(oldtuple.t_self)); - heap_fetch(rel, SnapshotAny, &oldtuple, &oldbuffer, NULL); - if (!oldtuple.t_data) + if (!heap_fetch(rel, SnapshotAny, &oldtuple, &oldbuffer, false, NULL)) elog(ERROR, "DeferredTriggerExecute: failed to fetch old tuple"); } if (ItemPointerIsValid(&(event->dte_newctid))) { ItemPointerCopy(&(event->dte_newctid), &(newtuple.t_self)); - heap_fetch(rel, SnapshotAny, &newtuple, &newbuffer, NULL); - if (!newtuple.t_data) + if (!heap_fetch(rel, SnapshotAny, &newtuple, &newbuffer, false, NULL)) elog(ERROR, "DeferredTriggerExecute: failed to fetch new tuple"); } |