Oracle 11g/R2 Query Result Cache - Incremental Update

Hi,
In Oracle 11g/R2, I created replica of HR.Employees table & executed the following statement (+Although using SUM() function is non-logical in this case, but just testifying the result+)
STEP - 1
SELECT      /+ RESULT_CACHE */ employee_id, first_name, last_name, SUM(salary)*
FROM           HR.Employees_copy
WHERE      department_id = 20
GROUP BY      employee_id, first_name, last_name;
EMPLOYEE_ID      FIRST_NAME LAST_NAME     SUM(SALARY)
202           Pat           Fay          6000
201           Michael           Hartstein     13000
Elapsed: 00:00:00.01
Execution Plan
Plan hash value: 3837552314
| Id | Operation           | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT      | | 2 | 130 | 4 (25)| 00:00:01 |
| 1 | RESULT CACHE      | 3acbj133x8qkq8f8m7zm0br3mu | | | | |
| 2 | HASH GROUP BY      | | 2 | 130 | 4 (25)| 00:00:01 |
|* 3 | TABLE ACCESS FULL     | EMPLOYEES_COPY | 2 | 130 | 3 (0)| 00:00:01 |
--------------------------------------------------------------------------------------------------     Statistics
0 recursive calls
0 db block gets
0 consistent gets
0 physical reads
0 redo size
*690* bytes sent via SQL*Net to client
416 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
2 rows processed
STEP - 2
INSERT INTO HR.employees_copy
VALUES(200, 'Dummy', 'User','[email protected]',NULL, sysdate, 'MANAGER',5000, NULL,NULL,20);
STEP - 3
SELECT      /*+ RESULT_CACHE */ employee_id, first_name, last_name, SUM(salary)
FROM           HR.Employees_copy
WHERE      department_id = 20
GROUP BY      employee_id, first_name, last_name;
EMPLOYEE_ID      FIRST_NAME LAST_NAME SUM(SALARY)
202      Pat      Fay      6000
201      Michael      Hartstein      13000
200      Dummy User      5000
Elapsed: 00:00:00.03
Execution Plan
Plan hash value: 3837552314
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT |          | 3 | 195 | 4 (25)| 00:00:01 |
| 1 | RESULT CACHE | 3acbj133x8qkq8f8m7zm0br3mu | | | | |
| 2 | HASH GROUP BY | | 3 | 195 | 4 (25)| 00:00:01 |
|* 3 | TABLE ACCESS FULL| EMPLOYEES_COPY | 3 | 195 | 3 (0)| 00:00:01 |
     Statistics
0 recursive calls
0 db block gets
4 consistent gets
0 physical reads
0 redo size
*714* bytes sent via SQL*Net to client
416 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
3 rows processed
In the execution plan of STEP-3, against ID-1 the operation RESULT CACHE is shown which shows the result has been retrieved directly from Result cache. Does this mean that Oracle Server has Incrementally Retrieved the resultset?
Because, before the execution of STEP-2, the cache contained only 2 records. Then 1 record was inserted but after STEP-3, a total of 3 records was returned from cache. Does this mean that newly inserted row is retrieved from database and merged to the cached result of STEP-1?
If Oracle server has incrementally retrieved and merged newly inserted record, what mechanism is being used by the Oracle to do so?
Regards,
Wasif
Edited by: 965300 on Oct 15, 2012 12:25 AM

965300 wrote:
Hi,
In Oracle 11g/R2, I created replica of HR.Employees table & executed the following statement (+Although using SUM() function is non-logical in this case, but just testifying the result+)
STEP - 1
SELECT      /+ RESULT_CACHE */ employee_id, first_name, last_name, SUM(salary)*
FROM           HR.Employees_copy
WHERE      department_id = 20
GROUP BY      employee_id, first_name, last_name;
EMPLOYEE_ID      FIRST_NAME LAST_NAME     SUM(SALARY)
202           Pat           Fay          6000
201           Michael           Hartstein     13000
Elapsed: 00:00:00.01
Execution Plan
Plan hash value: 3837552314
| Id | Operation           | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT      | | 2 | 130 | 4 (25)| 00:00:01 |
| 1 | RESULT CACHE      | 3acbj133x8qkq8f8m7zm0br3mu | | | | |
| 2 | HASH GROUP BY      | | 2 | 130 | 4 (25)| 00:00:01 |
|* 3 | TABLE ACCESS FULL     | EMPLOYEES_COPY | 2 | 130 | 3 (0)| 00:00:01 |
--------------------------------------------------------------------------------------------------     Statistics
0 recursive calls
0 db block gets
0 consistent gets
0 physical reads
0 redo size
*690* bytes sent via SQL*Net to client
416 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
2 rows processed
STEP - 2
INSERT INTO HR.employees_copy
VALUES(200, 'Dummy', 'User','[email protected]',NULL, sysdate, 'MANAGER',5000, NULL,NULL,20);
STEP - 3
SELECT      /*+ RESULT_CACHE */ employee_id, first_name, last_name, SUM(salary)
FROM           HR.Employees_copy
WHERE      department_id = 20
GROUP BY      employee_id, first_name, last_name;
EMPLOYEE_ID      FIRST_NAME LAST_NAME SUM(SALARY)
202      Pat      Fay      6000
201      Michael      Hartstein      13000
200      Dummy User      5000
Elapsed: 00:00:00.03
Execution Plan
Plan hash value: 3837552314
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT |          | 3 | 195 | 4 (25)| 00:00:01 |
| 1 | RESULT CACHE | 3acbj133x8qkq8f8m7zm0br3mu | | | | |
| 2 | HASH GROUP BY | | 3 | 195 | 4 (25)| 00:00:01 |
|* 3 | TABLE ACCESS FULL| EMPLOYEES_COPY | 3 | 195 | 3 (0)| 00:00:01 |
     Statistics
0 recursive calls
0 db block gets
4 consistent gets
0 physical reads
0 redo size
*714* bytes sent via SQL*Net to client
416 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
3 rows processed
In the execution plan of STEP-3, against ID-1 the operation RESULT CACHE is shown which shows the result has been retrieved directly from Result cache. Does this mean that Oracle Server has Incrementally Retrieved the resultset?
Because, before the execution of STEP-2, the cache contained only 2 records. Then 1 record was inserted but after STEP-3, a total of 3 records was returned from cache. Does this mean that newly inserted row is retrieved from database and merged to the cached result of STEP-1?
If Oracle server has incrementally retrieved and merged newly inserted record, what mechanism is being used by the Oracle to do so?
Regards,
Wasif
Edited by: 965300 on Oct 15, 2012 12:25 AMNo, the RESULT CACHE operation doesn't necessarily mean that the results are retrieved from there. It could be being
written to there.
Look at the number of consistent gets: it's zero in the first step (I assume you had already run this query before) and I would
conclude that the data is being read from the result cache.
In the third step there are 4 consistent gets. I would conclude that the data is being written to the result cache, a fourth step repeating
the SQL should show zero consistent gets and that would be the results being read.

Similar Messages

  • Query result caching on oracle 9 and 10 vs indexing

    I am trying to improve performance on oracle 9i and 10g.
    We use some queries that take up to 30 minutes to execute.
    I heard that there are some products to cache query results.
    Would this have any advantage over using indexes or materialized views?
    Does anyone know any products that I can use to cache the results of this queries on disk?
    Personally I think that by using the query result caching I would reduce the cpu time needed to process the query.
    Is this true?

    Your message post pushes all the wrong buttons starting with the fact that 9i and 10g are marketing labels not version numbers.
    You don't tune queries by spending money and throwing resources at them. You tune them by identifying the problem queries, running explain plans, visualizing their output using DBMS_XPLAN, and addressing the root cause.
    If you want help post full version numbers, the SQL statements, and the DBMS_XPLAN outputs.

  • Using the client result cache without the query result cache

    I have constructed a client in C# using ODP.NET to connect to an Oracle database and want to perform client result caching for some of my queries.
    This is done using a result_cache hint in the query.
    select /*+ result_cache */ * from table
    As far as I can tell query result caching on the server is done using the same hint, so I was wondering if there was any way to differentiate between the two? I want the query results to be cached on the client, but not on the server.
    The only way I have found to do this is to disable all caching on the server, but I don't want to do this as I want to use the server cache for PL/SQL function results.
    Thanks.

    e3a934c9-c4c2-4c80-b032-d61d415efd4f wrote:
    I have constructed a client in C# using ODP.NET to connect to an Oracle database and want to perform client result caching for some of my queries.
    This is done using a result_cache hint in the query.
    select /*+ result_cache */ * from table 
    As far as I can tell query result caching on the server is done using the same hint, so I was wondering if there was any way to differentiate between the two? I want the query results to be cached on the client, but not on the server.
    The only way I have found to do this is to disable all caching on the server, but I don't want to do this as I want to use the server cache for PL/SQL function results.
    Thanks.
    You haven't provided ANY information about how you configured the result cache. Different parameters are used for configuring the client versus the server result cache so you need to post what, if anything, you configured.
    Post the code you executed when you set the 'client_result_cache_lag' and 'client_result_cache_size' parameters so we can see what values you used. Also post the results of querying those parameters after you set them that show that they really are set.
    You also need to post your app code that shows that you are using the OCI statements are used when you want to use client side result cacheing.
    See the OCI dev guide
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28395/oci10new.htm#sthref1491
    Statement Caching in OCI
    Statement caching refers to the feature that provides and manages a cache of statements for each session. In the server, it means that cursors are ready to be used without the need to parse the statement again. Statement caching can be used with connection pooling and with session pooling, and will improve performance and scalability. It can be used without session pooling as well. The OCI calls that implement statement caching are:
      OCIStmtPrepare2()
      OCIStmtRelease()

  • Query result cache with functions

    Hi all,
    one of my colleagues has found a little bit weird behavior of a query result cache. He has set result_cache_mode = 'FORCE' (but it can be reproduced with a result_cache hint too) and suddenly functions called from the query get executed twice (for the first time) .
    An easy example:
    alter session set result_cache_mode = 'FORCE';
    create sequence test_seq;
    create or replace function test_f(i number)
    return number
    is                  
    begin
      dbms_output.put_line('TEST_F executed');
      --autonomous transaction or package variable can be used too
      return test_seq.nextval;
    end;
    prompt First call
    select test_f(1) from dual;
    prompt Second call
    select test_f(1) from dual;
    drop sequence test_seq;
    drop function test_f;
    First call
    TEST_F(1)
             2
    TEST_F executed
    TEST_F executed
    Second call
    TEST_F(1)
             1
    As you can see - for the first time the function is executed twice and return the value from the second execution. When I execute the query again it returns the value from the first execution... but it doesn't matter, problem is in the double execution. Our developers used to send emails via select (it's easier for them):
    select send_mail(...) from dual;
    ... and now the customers complains that they get emails twice
    And now the question - is there any way, hot to get rid of this behavior (without changing the parameter back or rewriting code)? I thought that the result cache is automatically disabled for non-deterministic functions...or is this an expected behavior?
    Thanks,
    Ivan

    Interesting.. you are right:
    SELECT /*+ RESULT_CACHE */ 'dog' FROM DUAL;
    And at the second execution:
    | Id  | Operation        | Name                       | Rows  | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT |                            |     1 |     2   (0)| 00:00:01 |
    |   1 |  RESULT CACHE    | cc5k01xyqz3ypf9t0j28r5gtd1 |       |            |          |
    |   2 |   FAST DUAL      |                            |     1 |     2   (0)| 00:00:01 |
    Hmmm..

  • Query results cached?

    For a report region, is the query results cached?
    That is, is the report query being executed again
    in the following condition:
    * when a user navigate between pages of a report
    (from page 1 (1-100 of 1000 rows) to page 2 (101-200 of 1000 rows)
    * when a user clicks on the column heading to sort the report

    Ken,
    In both cases the query is executed again.
    Regards,
    Marc

  • BEx Query results not getting updated

    Hi,
    I am using a BEx Query based on a multiprovider which is fetching data from a multiple remote cubes and multiple regular cubes.
    Now when data in the source system is getting changed the corresponding remote cubes are getting update but query result are not getting re-fresh for at least 2 hours.
    We have already tried doing logging out and and logging into the bex system.
    Is there some cache setting which is required?
    Default cache mode in query is  'Main memory cache without swapping'.
    Kindly advice.
    Regards
    Vivek

    Hi,
    Just generate your query once with program RSR_GEN_DIRECT_ALL_QUERIES.
    By selecting your multiprovider .
    Thanks,
    Ranjan

  • Oracle 11g unpivot query help

    Hello,
    I have a single row of data showing school term start and end dates in 2011/12. I need to convert this single row of data (containing 16 columns) into 5 rows comprised of just 4 columns (year, term, term_start, term_end).
    Is it possible to use just Oracle 11g's unpivot function_ to convert the following 16 columns of data:
    select * from
    (select 2012 as terms_year,
    1 as T1,'05-SEP-2011' as T1_SD, '21-OCT-2011' as T1_ED,
    2 as T2,'31-OCT-2011' as T2_SD, '16-DEC-2011' as T2_ED,
    3 as T3,'03-JAN-2012' as T3_SD, '10-FEB-2012' as T3_ED,
    4 as T4,'20-FEB-2012' as T4_SD, '30-APR-2012' as T4_ED,
    5 as T5,'16-APR-2012' as T5_SD, '01-JUN-2012' as T5_ED
    from dual) mytable
    aka
    TERMS_YEAR             T1                     T1_SD       T1_ED       T2                     T2_SD       T2_ED       T3                     T3_SD       T3_ED       T4                     T4_SD       T4_ED       T5                     T5_SD       T5_ED      
    2012                   1                      05-SEP-2011 21-OCT-2011 2                      31-OCT-2011 16-DEC-2011 3                      03-JAN-2012 10-FEB-2012 4                      20-FEB-2012 30-APR-2012 5                      16-APR-2012 01-JUN-2012 into the following 4 columns of data (year, term, term_start, term_end):
    select terms_year, term, t1_sd as term_start, t1_ed as term_end from
    (select 2012 as terms_year, 1 as term, '05-SEP-2011' as T1_SD, '21-OCT-2011' as T1_ED from dual union all
    select 2012 as terms_year, 2 as term, '31-OCT-2011' as T2_SD, '16-DEC-2011' as T2_ED from dual union all
    select 2012 as terms_year, 3 as term, '03-JAN-2012' as T3_SD, '10-FEB-2012' as T3_ED from dual union all
    select 2012 as terms_year, 4 as term, '20-FEB-2012' as T4_SD, '30-APR-2012' as T4_ED from dual union all
    select 2012 as terms_year, 5 as term, '16-APR-2012' as T5_SD, '01-JUN-2012' as T5_ED from dual) mytable
    aka
    TERMS_YEAR             TERM                   TERM_START  TERM_END   
    2012                   1                      05-SEP-2011 21-OCT-2011
    2012                   2                      31-OCT-2011 16-DEC-2011
    2012                   3                      03-JAN-2012 10-FEB-2012
    2012                   4                      20-FEB-2012 30-APR-2012
    2012                   5                      16-APR-2012 01-JUN-2012 Much obliged if anyone can teach me how - I can't get my head around the pivot/unpivot syntax! E.g.
    Select *
    From mytable
    UNPIVOT (
    unpivot_clause
    unpivot_for_clause
    unpivot_in_clause)
    Thanks,
    TP.

    Hi,
    Using the SELECT ... PIVOT feature:
    SELECT       terms_year
    ,       term
    ,       term_start
    ,       term_end
    FROM       mytable
    UNPIVOT       (  ( term
              , term_start
              , term_end
              )     FOR num_col
                 IN ( (t1, t1_sd, t1_ed)     AS 1
                 , (t2, t2_sd, t2_ed)     AS 2
                 , (t3, t3_sd, t3_ed)     AS 3
                 , (t4, t4_sd, t4_ed)     AS 4
                 , (t5, t5_sd, t5_ed)     AS 5
    ORDER BY  terms_year     -- If needed
    ,            num_col
    ;The basic syntax for UNPIVOTing to 1 column (plus a label column) is
    UNPIVOT (    outcol
         FOR  label     IN ( incol_1  AS label_val_1
                           , incol_2  AS label_val_2
                      , incol_n  AS label_val_n
         )where
    outcol       is the pivoted output column, containing values from the original table,
    label       is a label column, which will contain values hard-coded in the query,
    incol_1, incol_2, ..., incol_n       are the columns from the origianl table to be unpivoted
    label_val_1, label_val_2, ..., label_val_n       are the hard-coded values that will go in the label column.
    The syntax for pivoting to m columns (m > 1) is like that for pivoting 1 column, but
    instead of outcol, you give a comma-delimited list of m outcols, enclosed in parentheses, and
    instead of incol_1, incol_2, ... incol_n, you give a comma-delimited list of m columns, enclosed in parentheses.
    By the way, storing dates in VARCHAR2 columns is not a very good idea. Use DATE columns instead.
    Edited by: Frank Kulash on Jul 16, 2012 6:11 PM

  • Oracle 11g spatial query

    An Oracle 11g spatial database with 5 features in it. A doughnut, triangle, line, trapezium, pentagon.
    I want to query what coordinates of features exist in a rectange box including the last point that intersects the rectangle box.
    It really difficult to explain without pictures. Please look at this page.
    http://www.h2ss.co.uk/q/question.jsp
    Thanks, I appreciate it.

    Thanks for the replies.
    I acknowledge that what bkzar and jsharma say will work. But in real terms it is impractical for me to create a new table with the SDO_GEOMETRY's. I have over a thousand polygons, each with over 5000 points in my spatial table.
    Let me give you a background to what I am trying to achieve.
    I am trying to extract features from 11g and render them on Google Maps. However some of my polygons are huge and have over 5000 points, Google cannot render them effectively, however Google does give me the coordinates of the visible view, i.e the current rectangle view.
    My idea was that if you are zoomed right into Google Map and a particular feature intersects the rectangle view than I can query for a portion of the feature, including the first and last points that fall outside of the rectangle box.
    I need to be able to somehow filter the SDO_GEOMETRY that don't exist in the rectangle box.
    Thanks

  • Oracle 11g : UTL_FILE query

    Hi,
    I am having 2 server. One server has oracle database while on another one is application server where all the data files and application specific shell scripts are kept. We are connecting to database via the application server.
    I am using Oracle 11g:
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE 11.1.0.6.0 Production
    TNS for HPUX: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    I know that using UTL_FILE in PL/SQL procedure we can create file on the server (where oracle is installed).
    My requirement is generated some report which will involve writing to more than 2 files simultaneously. I know I can easily do this in PL/SQL procedure.
    But my issue is that due to space issue I cannot generate the files on database server and need to generate the same on the application one (client side)
    Queries:
    1] Is it also possible to create file on client machince instead of server in my case the application server via PL/SQL because I read that in Oracle 11g
    UTL_FILE provides file access both on the client side and on the server side.
    2] If yes any idea, how is this possible?
    3] If not, is there any way by which I can write to 2 or more file simultaneously on the client using oralce. I know SQL*Plus can spool file on client. But it is only one file at a time.
    Rgds,
    Amol

    Looking at the 11g documentation you are probably referring to:
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/u_file.htm#BABDEJDH
    where it says...
    >
    UTL_FILE provides file access both on the client side and on the server side. When run on the server, UTL_FILE provides access to all operating system files that are accessible from the server. On the client side, as in the case for Forms applications, UTL_FILE provides access to operating system files that are accessible from the client.
    >
    This is referring to client installed forms applications where it provides a local UTL_FILE functionality that accesses the local file system. It doesn't mean that UTL_FILE within PL/SQL that is running on the database server can access the client machine's file system as this would also be a breach of network security.

  • Oracle 11g Certification Query

    Hi all,
    I have given my Oracle 11g exams for OCP certification. Now, i need to take one of the mandatory training to fulfill the requirements for certification. I am in Kuwait and when i select the country as Kuwait, the cheapest training course is of $1230. I am an indian, so when i select the country as India on the oracle site, the price reduces down to $540 for the same course. This is for the Live Virtual Class (LVC) rates. Can i book the LVC with India as country. Do I have to be present in India for the LVC training or only taking a course is compulsion.
    Kindly advice.

    Zuzar Sajjad Tutawala wrote:
    Hi all,
    I have given my Oracle 11g exams for OCP certification. Now, i need to take one of the mandatory training to fulfill the requirements for certification. I am in Kuwait and when i select the country as Kuwait, the cheapest training course is of $1230. I am an indian, so when i select the country as India on the oracle site, the price reduces down to $540 for the same course. This is for the Live Virtual Class (LVC) rates. Can i book the LVC with India as country. Do I have to be present in India for the LVC training or only taking a course is compulsion.
    Kindly advice.If you take LVC training my understanding, and it has been discussed in previous threads, if you need to be prsent in the country from which hte LVC is being presented. So if you want to take it in India you will need to travel back there.

  • Oracle 11g :SELECT query blocked..??

    Hi Experts,
    could you please explain why the below SQL query is blocked?
    SELECT 1 FROM DUAL is blocking the SQL statement on GTTAPPUSR@gttccuatcriba04 ( SID=469 ) blocked SQL -> DELETE FROM GTTDB.PURCHASE_ENTRY_ID=:1
    SELECT 1 FROM DUAL is blocking the SQL statement on GTTAPPUSR@gttccuatcriba04 ( SID=367 ) blocked SQL -> DELETE FROM GTTDB.PURCHASE_ENTRY_ID=:1
    I am scratching my head without any solution when I had a look at the db today. Thanks in advance for your help.
    Regards,
    Boris
    Edited by: user12075620 on Dec 4, 2012 8:58 AM

    The SELECT statement is not blocking the UPDATE. As I said in the previous reply, the string that this query produces does not match the logic.
    This query is (at least on the surface) correctly identifying that session 1 is blocking session 2. Session 1 holds some lock that session 2 is waiting on. So far, so good. Since session 2 is waiting on the lock, we can easily enough see what session 2 is running (the UPDATE statement). But since session 1 is not blocked, it is potentially off running a ton of other SQL statements (or no SQL statement at all). The query is looking to see what session 1 is running currently. It has no way of determining what session 1 ran at some point in the past to acquire the lock in the first place.
    Going back to my KING example,
    At noon, session 1 runs
    UPDATE emp
       SET sal = sal * 2
    WHERE ename = 'KING'Session 1 now has a lock on the KING row in the EMP table. But session 1 neither commits nor rolls back, it is still in a transaction. Session 1 might not have any more activity for a long time-- the user might go off to lunch, for example (obviously, applications should not be designed to allow users to maintain open transactions indefinitely, but not all applications are designed correctly). Or it might start running other queries. Let's say that session 1 now runs a query that is going to go for an hour
    SELECT *
      FROM giant_view_with_lots_of_computationsNow, at 12:45, session 2 comes in and runs
    UPDATE emp
       SET bonus = 100
    WHERE ename = 'KING'Session 2 is blocked. Session 2 is running the UPDATE statement. Session 1 still holds the lock but it is running some completely unrelated SQL statement.
    If we run the query you posted, the query will correctly report that session 1 is running the query against the GIANT_VIEW_WITH_LOTS_OF_COMPUTATIONS but incorrectly imply that this SELECT query is the source of the lock. It is not. It simply happens to be the query that the session that does hold the lock happens to be executing at the current moment (why the application seems to be running a lot of queries that select a constant from dual is a separate question).
    Justin

  • Does OCI client result cache and oracle UCP work together?

    I'm using Oracle 11.2.1.0. I've set up FCF and enabled OCI result cache on server side, so on client side, I'm using UCP for failover.
    this is my datasource configuration:
    <Resource name="jdbc/MyPool"
    auth="Container"
    factory="oracle.ucp.jdbc.PoolDataSourceImpl"
    type="oracle.ucp.jdbc.PoolDataSource"
    connectionFactoryClassName="oracle.jdbc.pool.OracleDataSource"
    url="jdbc:oracle:oci:@dbhost:1521/myDb"
    user="db_user"
    password="db_password"
    fastConnectionFailoverEnabled="true"
    onsConfiguration=""
    connectionPoolName="dbPool"
    initialPoolSize="5"
    minPoolSize="5"
    maxPoolSize="25"
    connectionWaitTimeout="10000"
    inactiveConnectionTimeout="120000"
    abandonConnectionTimeout="60"
    validateConnectionOnBorrow="true"
    sqlForValidateConnection="select user from dual"
    maxStatements="30"/>
    I've enabled OCI client result cache.
    I use /*+ result_cache */ in my query to take advantage of the result cache.
    so I execute the following scenario:
    i) select /*+ result_cache */ value from myTable where id=1; (this returns a result.)
    ii) update myTable to set a different value for id=1 record;
    iii) run select query again; (this should return a different result. oci result cache gets updated when table changes.)
    if I take out
    "sqlForValidateConnection" and/or "validateConnectionOnBorrow" (i.e. disable sql validation on borrow), the 2nd query after table update doesn't show the latest result. it's still showing the old query result.
    is this a bug? that UCP validation on borrow has an impact on OCI result cache function? this doesn't happen if using dbcp java connection pooling with OCI result cache.

    it turns out I ran the test against an oracle server that doesnt have FCF configured, nor ONS.
    once i switched to a correct oracle cluster, my test passed.

  • Need suggestion for Column update in query results

    While generating reports using Oracle 10g SQL Query, we need to update the few of columns data with business calculations. We are processing large amount of data. Kindly suggest us, for the best method to achieve this.

    i don't know about Oracle 10 SQL Query but i wouldn't mix reporting with data calcuations which is stored persistent in the database. I would separate them, e.g. you could create a database-job to execute your updates at a specific time each day.
    hope this helps

  • Oracle 11g advantages for performance

    Hello,
    I am doing test of Client side result set cache on oracle 11 g rel2 ,O/S- RHEL
    i am doing test as below on 2 Oracle 11g rel2 test servers on RHEL
    one oracle 11g rel2 instance is used as server1,from other oracle 11g rel2 server2, i am running queries connecting to server1 through sqlplus,listener(tnsnames )
    i run query few times without any client cache settings then
    i have set init.ora paras for oracle 11g rel2 for client result cache,cache size/cache lag
    i run the same query few times
    in both the cases after each run i am noting statistics
    select * from V$RESULT_CACHE_OBJECTS;
    select * from V$CLIENT_RESULT_CACHE_STATS;
    select * from gv$cpool_conn_info;
    also autotrace,plan etc
    but after using cache this views are getting poplulated ,autiotrace plan shows cache is used
    but i cant see any improvement in performance after using client cache like speed,reduce network trip, etc
    in fact without using cache/with no hint ,query executes faster
    let me know if i am missing something,i believe sqlplus internally using OCI
    thanks

    >
    I tested with custom code using java/jdbc thin driver ,connecting same as between 2 oracle 11g2 instance 1 as client other server,running code calling queries from client connecting to server
    >
    Unless you plan to provide the information ask for about what it is you are doing there really isn't any point in providing status updates that: you test this, you tested that. You made several statements about what you were doing
    >
    i have set init.ora paras for oracle 11g rel2 for client result cache,cache size/cache lag
    i run the same query few times
    in both the cases after each run i am noting statistics
    select * from V$RESULT_CACHE_OBJECTS;
    select * from V$CLIENT_RESULT_CACHE_STATS;
    select * from gv$cpool_conn_info;
    also autotrace,plan etc
    >
    and were asked to provide specific information that you haven't provided nor have you provided the query.
    >
    You say you are doing a bunch of things
    But you don't post any of those results so we can see what it is you are looking at.
    No one can comment on things they can't see.
    >
    You have to be using OCI for client side caching so if you use the Java thin driver but don't use OCI there won't be any cacheing. There also won't be any if it is not enabled or if the query has certain constraints as listed in the doc
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28395/oci10new.htm#CHDGGFEF
    >
    Queries that are not Cached
    There are queries that are not cached on the OCI client even if the result cache hint is specified. Such queries may be cached on the database if the server result cache feature is enabled (see Oracle Database Concepts, "SQL Query Result Cache" for more information). If a SQL query includes any of the following, then the result set of that query is not cached in the OCI client result cache:
    •Views
    •Remote objects
    •Complex types in the select list
    •Snapshot-based or flashback queries
    •Queries executed in a serializable, read-only transaction, or inside a flashback session
    •Queries that have PL/SQL functions in them
    •Queries that have VPD policies enabled on the tables
    >
    This Oracle-Developer.net article author doesn't seem to have any trouble caching results.
    http://www.oracle-developer.net/display.php?id=503

  • SQL Result Cache  vs In-Memory Database Cache

    Hi,
    can anyone help me to understand the relations and differences between the 11 g new features of SQL Result Cache vs In-Memory Database Cache ?
    Thanks

    I highly recommend you read the 11g New Features Guide. Here is a sample from it:
    h4. 1.11.2.9 Query Result Cache
    A separate shared memory pool is now used for storing and retrieving
    cached results. Query retrieval from the query result cache is faster
    than rerunning the query. Frequently executed queries will see
    performance improvements when using the query result cache.
    The new query result cache enables explicit caching of results in
    database memory. Subsequent queries using the cached results will
    experience significant performance improvements.
    See Also:
    [Oracle Database Performance Tuning Guide|http://download.oracle.com/docs/cd/B28359_01/server.111/b28274/memory.htm#PFGRF10121] for details
    [Results Cache Concepts|http://download.oracle.com/docs/cd/B28359_01/server.111/b28274/memory.htm#PFGRF10121|Results Cache Concepts]
    HTH!

Maybe you are looking for