Andrew Dunstan <andrew@dunslane.net> writes:
> How expensive is this going to be, especially for huge numbers of rows?
Certainly cheaper than firing a per-row trigger.
> Would it be done for all queries, or just those with a per statement
> trigger, or only when explicitly requested?
Just when there's a per-statement AFTER trigger, I would think. One of
the tricky parts is to minimize overhead if the trigger never actually
asks for access to the rows. However, if all we do during the statement
is build a possibly-lossy bitmap, I don't think the overhead will be
bad.
It might be interesting to think about reimplementing the RI triggers
as per-statement, too ...
regards, tom lane