Subject Re: Doubt about RDB$GET_CONTEXT
Author Dmitry Yemanov
29.03.2014 00:45, valdir@... wrote:
>
> Regarding the database optimizer and query performance.
> Does RDB$GET_CONTEXT on a where clause would be treated like a literal
> value?
> Or should I consider it a select on an one record table?
>
> I'm trying to emulate database constants for some known defined values
> on my application.
> Or the following three statements are equivalent and I shouldn't worry
> about it?
>
> select .. from .. where FIELD = 500;
> select .. from .. where FIELD = RDB$GET_CONTEXT('USER_SESSION', 'MY_VALUE');
> select .. from .. where FIELD = (select MY_VALUE from CFG_TABLE) --
> CFG_TABLE will ever have only one record;

Table access is slower than RDB$GET_CONTEXT which in turn is slower than
a constant.


Dmitry