Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Two users, one query, two optimizer plans
User A is schema owner. User B has select on user A's objects, and is
subject to row-level security policy on user A's objects. (Row-level
security predicate function returns empty string if user issuing SQL is
owner of object).
I have one query in particular that produces different optimizer plans depending on whether it's run by user A or user B.
The plan produced by user A (schema owner) is
This plan is inefficient (see full table scan at ID 6) and query takes approximately 35 minutes to run.
The plan produced by user B is
and takes a couple of minutes.
For each table subject to row-level security policy, the RLS view is of the form
SELECT <columns> FROM <table> WHERE company_fk in (hextoraw('<value>')
My theory at this point is that RLS is causing the discrepancy in optimizer plans. Has anyone seen this? Is there another reason why the plans would differ?
Thanks,
-- Paul Baumgartel paul.baumgartel_at_aya.yale.edu -- http://www.freelists.org/webpage/oracle-lReceived on Tue Jan 17 2006 - 15:26:07 CST
![]() |
![]() |