Reduce the memory footprint of large pending-trigger-event lists, as per my
recent proposal. In typical cases, we now need 12 bytes per insert or delete event and 16 bytes per update event; previously we needed 40 bytes per event on 32-bit hardware and 80 bytes per event on 64-bit hardware. Even in the worst case usage pattern with a large number of distinct triggers being fired in one query, usage is at most 32 bytes per event. It seems to be a bit faster than the old code as well, due to reduction of palloc overhead. This commit doesn't address the TODO item of allowing the event list to spill to disk; rather it's trying to stave off the need for that. However, it probably makes that task a bit easier by reducing the data structure's dependency on pointers. It would now be practical to dump an event list to disk by "chunks" instead of individual events.
This commit is contained in:
parent
3ca5aa6cbc
commit
312b1a983f
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/commands/trigger.h,v 1.68 2008/09/19 14:43:46 mha Exp $
|
||||
* $PostgreSQL: pgsql/src/include/commands/trigger.h,v 1.69 2008/10/24 23:42:35 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -56,10 +56,8 @@ typedef struct TriggerData
|
||||
|
||||
/* More TriggerEvent flags, used only within trigger.c */
|
||||
|
||||
#define AFTER_TRIGGER_DONE 0x00000010
|
||||
#define AFTER_TRIGGER_IN_PROGRESS 0x00000020
|
||||
#define AFTER_TRIGGER_DEFERRABLE 0x00000040
|
||||
#define AFTER_TRIGGER_INITDEFERRED 0x00000080
|
||||
#define AFTER_TRIGGER_DEFERRABLE 0x00000010
|
||||
#define AFTER_TRIGGER_INITDEFERRED 0x00000020
|
||||
|
||||
#define TRIGGER_FIRED_BY_INSERT(event) \
|
||||
(((TriggerEvent) (event) & TRIGGER_EVENT_OPMASK) == \
|
||||
|
Loading…
x
Reference in New Issue
Block a user