Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

V('APP_USER') in where clause

satishpMar 18 2022

so i was reading http://www.laureston.ca/2019/12/05/15-top-tips-to-tune-your-oracle-apex-performance/ ..
Says:
5. Beware of v(”) notation
If you have identified a poorly performing report, one thing you can check is if you may have used the v(”) notation when you could have used the bind variable.

select task_name
from tasks
where assigned_to=:APP_USER

vs

select task_name
from tasks
where assigned_to=v('APP_USER')

On a large table, the difference between the two statements can be huge, because the v(”) is actually a function call. This means that you will not be taking advantage of any indexes and the query will result in a full table scan.
Hint: if you need to refer to APEX session state in a view (where you cannot use bind variables), consider using a scalar subquery which can perform almost as well as your bind variable. See below.

select task_name
from tasks
where assigned_to = (select v('APP_USER') from dual)

===========
Is that true? In my queries that use V('APP_USER') on tables that have the column indexed, the explain plan shows that the index is being used..
On Oracle 19c.

This post has been answered by fac586 on Mar 18 2022
Jump to Answer
Comments
Post Details
Added on Mar 18 2022
2 comments
3,215 views