Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9234481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:47:59+00:00 2026-06-18T06:47:59+00:00

Let’s assume there are two database users: (1) A user named APP who connects

  • 0

Let’s assume there are two database users: (1) A user named APP who connects to the database very often and queries and modifies many tables in his own schema. (2) A user named WEB who only connects to the database rarely and only queries and modifies a few tables in the APP schema.

I need to limit the table access of both users depending on the data. I’m using the Oracle Virtual Private Database (VPD) feature (sometimes also known as fine-grained access control) to do this. For this question only the rule which limits the APP user is important. The rule which limits the WEB user needs to be in a seperate VPD policy (I might later ask a similar question for that policy).

Which of the following two implementations would give the better query and DML performance for the APP user?

1) Create the policy with policy_type dbms_rls.SHARED_CONTEXT_SENSITIVE and implement the policy function like this:

FUNCTION get_predicate(i_schema IN VARCHAR2, i_object IN VARCHAR2)
RETURN VARCHAR2
AS
BEGIN
  IF SYS_CONTEXT('USERENV', 'SESSION_USER') = 'WEB' THEN
    RETURN NULL;
  END IF;

  RETURN 'some_id_column = SYS_CONTEXT(''APP'', ''some_id'')';
END get_predicate;

2) Create the policy with policy_type dbms_rls.SHARED_STATIC and implement the policy function like this:

FUNCTION get_predicate(i_schema IN VARCHAR2, i_object IN VARCHAR2)
RETURN VARCHAR2
AS
BEGIN
  RETURN 'SYS_CONTEXT(''USERENV'', ''SESSION_USER'') = ''WEB'' OR some_id_column = SYS_CONTEXT(''APP'', ''some_id'')';
END get_predicate;

Note that the APP user uses client connection pooling (provided by ODP.NET), so it should only open a few connections for each application usage session. There are around 100 clients which will connect to the database.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:48:01+00:00Added an answer on June 18, 2026 at 6:48 am

    The STATIC predicate will only be evaluated once for the session whereas the CONTEXT_SENSITIVE predicate will be re-evaluated every time the middle tier (or the application) re-sets the context. If most of the connections are through the same user (APP) then probably you won’t have many context changes (depending on how you manage things in the connecting layer).

    However, even if you have shedloads of context changes I would be very surprised if the overhead of re-evaluating the CONTEXT_SENSITIVE predicate was a noticeable element of the total cost of connection. Almost certainly you have bigger performance gains to be made in other parts of your architecture.

    So, choose the option which is easier to understand or offers the greater flexibility. Only you can decide what criteria matter. For instance, if you built your policy string generators in a package (rather than the standalone function posted) and that package doesn’t hold state you could change your policies on the fly, without disrupting the sessions. However, a STATIC policy will not be applied unless you kill the sessions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let A and B be two tables in a database schema. A and B
Let's say I'm outputting a post title and in our database, it's Hello Y’all
Let's say I'm building an app that displays a UITableView of contacts. The user's
Let's have an example like below: package xliiv.sandbox; import android.app.Activity; import android.os.Bundle; import android.util.Log;
Let's say I have a method in java, which looks up a user in
Let's say that I have a SQLite database that I create in a separate
Let's say I have thousands of users and I want to make the passwords
Let's say I've got two files class.php and page.php class.php <?php class IUarts {
Let's say I have deployed my Rails app on a VPS, and everything works
Let's say I have a main folder in my website named test which contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.