Subject RDB$Set_Context v GTT v Disk writes
  My middle tier application uses a pool of firebird connections to do its work. In order to identify users for audit purposes the application currently fills a global temporary table with the user id for a connection before doing any actual work. This results in an overhead of one transaction and one stored procedure call per client call to my stateless server. Using process monitor I can see that this equals 5 disk write operations.
  I have experimented with RDB$SET_CONTEXT as well and it is more efficient. It needs 3 disk writes for the equivalent operation. I'm guessing that these come from the transaction rather then the SET_CONTEXT call.

  Out of curiosity, and in a quest to minimise disk writes, is there a better way to do this? Is there some way to call RDB$SET_CONTEXT without a transaction? or is it feasible to implement some kind of in memory callback mechanism using UDF's. The idea being that the database will only call the udf when it needs to.

Many thanks in advance.