Oracle 11g R1 tablespace query ?

Currently within our 9i environment, a decision was made to split the data / index table into individual tablespaces (Data Large/Medium/Small/Etc). Each of these tablesspaces are not spilt over physical disc but are part of a single disk array. We are now conducting an upgrade to Oracle 11g R1 (using a single array), and the question has arisen regarding keeping the same tablespace structure as we currently use in 9i. The question that I have is should we carry on using this format, or should we place all tables/indexes into a single tablespace (Data/Index). From an OS point of view, I can’t see any benefit from doing this, but from an Oracle point of view, it might. What are everybody’s thoughts.

hi,
Its your convienent to keep into a same tablespace or diff.. if you face i/o probs or performance problem then you can store the datas in diff tbls according to that.
without knowing the DB usage and performance .. we can't say anything.. its your choice ..
regards,
Deepak

Similar Messages

  • Oracle 11g on Linux : Query Optimization issue

    Hi guru,
    I am facing one query optimization related problem in group by query
    Table (10 million Records)
    Product(ProductId number,ProductName varchar(100),CategoryId VARCHAR2(38),SubCategoryId VARCHAR2(38))
    Index
    create index idxCategory on Product (CategoryId,SubCategoryId)
    Query1:To find product count for all CategoryId and SubCategoryId
    select CategoryId,SubCategoryId,count(*) from Product group by CategoryId,SubCategoryId
    Above query is not using index idxCategory and doing table scan which is very costly.
    When I fire Query2: select count(*) from Product group by CategoryId,SubCategoryId
    then it is properly using index idxCategory and very fast.
    Even I specified hint in Query1 but it is not using hint.
    Can anybody suggest why oracle is not using index in Query1 and what should I do so that Query1 will use Index.
    Thanks in advance.

    user644199 wrote:
    I am facing one query optimization related problem in group by query
    Query1:To find product count for all CategoryId and SubCategoryId
    select CategoryId,SubCategoryId,count(*) from Product group by CategoryId,SubCategoryId
    Above query is not using index idxCategory and doing table scan which is very costly.
    When I fire Query2: select count(*) from Product group by CategoryId,SubCategoryId
    then it is properly using index idxCategory and very fast.
    Even I specified hint in Query1 but it is not using hint.
    Can anybody suggest why oracle is not using index in Query1 and what should I do so that Query1 will use Index.The most obvious reason that the table needs to be visited would be that the columns "CategoryId" / "SubCategoryId" can be NULL but then this should apply to both queries. You could try the following to check the NULL issue:
    select CategoryId,SubCategoryId,count(*) from Product where CategoryId is not null and SubCategoryId is not null group by CategoryId,SubCategoryId
    Does this query use the index?
    Can you show us the hint you've used to force the index usage and the EXPLAIN PLAN output of the two queries including the "Predicate Information" section? Use DBMS_XPLAN.DISPLAY to get a proper output, and use the \ tag before and after when posting here to format it using fixed font. Use the "Quote" button in the message editor to see how I used the \ tag here.
    Are above queries representing the actual queries used or did you omit some predicates etc. for simplicity?
    By the way, VARCHAR2(38) and ...ID as name, are these columns storing number values?
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Regarding using text editor in 11g for writting query

    how can i use text editor in oracle 11g for writting query as in oracle 9i in which we use 'ed' command.

    user13063489 wrote:
    how can i use text editor in oracle 11g for writting query as in oracle 9i in which we use 'ed' command.This is really for asking in the database forum.
    However I assume you are using sqlplus
    If this is the case define the _EDITOR variable to one of the following as appropriate ....
    DEFINE _EDITOR=notepad
    DEFINE _EDITOR=vi
    For more assistance use the database general forum.

  • About oracle 11g

    One of the new feature about oracle 11g is continuous query notification. Where can I find the detail information about it?

    On the 11g new features manual it states:
    "1.1.6.4 JDBC Support for Continuous Query Notification
    This feature allows Java Applications or Containers to subscribe to SQL queries watch list in the database and be notified when:
    * DML or DDL changes affect the objects associated with the queries, or
    * DML or DDL changes affect the result set
    The notifications are published when the transaction (DML or DDL) commits.
    Java Applications and Container prevents unnecessary database querying and implements efficient and consistent result set caching and cache invalidation."
    You may read further at Database Change Notification.
    ~ Madrid

  • Query not considering function based index in oracle 11g

    I have a query which used Function Based Index when run in oracle 9i but when I run the same query
    without any changes, it does not consider index. Below is the query:
    SELECT distinct patient_role.domain_key, patient_role.patient_role_key,
    patient_role.emergency_contact_name,
    patient_role.emergency_contact_phone, patient_role.emergency_contact_note,
    patient_role.emergency_contact_relation_id,
    patient_role.financial_class_desc_id, no_known_allergies, patient_role.CREATED_BY,
    patient_role.CREATED_TIMESTAMP,
    patient_role.CREATED_TIMESTAMP_TZ, patient_role.UPDATED_BY, patient_role.UPDATED_TIMESTAMP,
    patient_role.UPDATED_TIMESTAMP_TZ,
    patient_role.discontinued_date
    FROM encounter, patient_role
    WHERE patient_role.patient_role_key = encounter.patient_role_key
    AND UPPER(TRIM(leading :SYS_B_0 from encounter.account_number)) = UPPER(TRIM(leading :SYS_B_1 from
    :SYS_B_2))
    AND patient_role.discontinued_date IS null
    AND encounter.discontinued_date IS null ;
    Index definition:
    CREATE INDEX "user1"."IX_TRIM_ACCOUNT_NUMBER" ON "user1."ENCOUNTER" (UPPER(TRIM(LEADING
    '0' FROM "ACCOUNT_NUMBER")), "PATIENT_ROLE_KEY", "DOMAIN_KEY", "DISCONTINUED_DATE")
    PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
    BUFFER_POOL DEFAULT)
    TABLESPACE "user1"
    Database : Oracle 11g (11.2.0.3)
    O/S : Linux 64 bit (the query does not consider index even on windows os)
    Any suggestions?
    -Onkar
    Edited by: onkar.nath on Jul 2, 2012 3:32 PM

    Onkar,
    I don't appreciate you posting this question in several forums at the same time.
    If I would know you also posted this on Asktom, I wouldn't even have bothered.
    As to your 'issue':
    First of all: somehow cursor_sharing MUST have been set to FORCE. Oracle is a predictable system, not a fruitmachine.
    Your statement the '0' is replaced by a bind variable anyway is simply false. If you really believe it is not false, SUBMIT a SR.
    But your real issue is not Oracle: it is your 'application', which is a mess anyway. Allowing for alphanumeric numbers is a really bad idea.
    Right now you are already putting workaround on workaround on workaround on workaround.
    Issue is the application: it is terminal., and you either need to kill it, or to replace it.
    Sybrand Bakker
    Senior Oracle DBA

  • Tablespace usage in Oracle 11g

    Hi Guys,
    Not sure if this has been asked before.
    I have created a couple of table spaces in my database and one of these tables is holding all my data. For that table space, I have added at least 8 data files so far and it seems that Oracle uses the free space very quickly. I would like to know following things
    1. Is there anyway to know that usage of data files with respect to table stored in it? In other words - would I be able to know if Table-A stored in datafile 1?
    2. Is there anyway to reuse the old data files?
    3. I am not sure if it is an Oracle instance, but it seems to be that Oracle 11g uses the free space very quickly (I can understand that it depends on the data) so just curious to know if there is anyway to minimize the usage.
    Any information on this would be useful and appreciated.
    Thanks
    Regards
    Jiggy

    Is there anyway to know that usage of data files with respect to table stored in it? In other words - would I be able to know if Table-A stored in datafile 1? The tables are actually stored in the tablespaces itself , spanned to multiple datafiles. Query dba_segments and dba_extents to find out that in which tablespace and datafile(s) , your tables are spread across.
    Is there anyway to reuse the old data files?In what way? If it is a Locally Managed Tablespace, Oracle would reuse the space becoming free automatically within the tablespace for the subsequent data.
    I am not sure if it is an Oracle instance, but it seems to be that Oracle 11g uses the free space very quickly (I can understand that it depends on the data) so just curious to know if there is anyway to minimize the usage. No such thing at least in my knowledge. Space being used would solely depend on the incoming data and not on the release of the db.
    Aman....

  • UNDOTBS1 and SYSAUX Tablespace Filename Mismatch in Oracle 11g XE

    Hi,
    We have installed Oracle 11g XE 32 bit on Windows and found that Tablespace name and filenames are mismatched for UNDOTBS1, SYSAUX.
    If you run following query:
    SELECT TABLESPACE_NAME, FILE_NAME FROM DBA_DATA_FILES; You will get below output:
    TABLESPACE_NAME                    FILE_NAME
    ============================================================================
    USERS                C:\ORACLE\ORACLE11GXE\APP\ORACLE\ORADATA\XE\USERS.DBF
    UNDOTBS1           C:\ORACLE\ORACLE11GXE\APP\ORACLE\ORADATA\XE\SYSAUX.DBF
    SYSAUX                C:\ORACLE\ORACLE11GXE\APP\ORACLE\ORADATA\XE\UNDOTBS1.DBF
    SYSTEM                C:\ORACLE\ORACLE11GXE\APP\ORACLE\ORADATA\XE\SYSTEM.DBFNotice the difference between UNDOTBS1 and SYSAUX.
    UNDOTBS1 tablespace has filename SYSAUX.DBF while
    SYSAUX tablespace has filename UNDOTBS1.DBF
    Is this a bug or just a wrong name mapping?
    Will this affects the internal behavior of tablespace as well for undo tablespace and APEX Installation?
    Regards,
    Sohil Bhavsar.

    Error: ORA-03297 ... related to this mismatch of UNDOTBS1 with SYSAUXActually its related to trying to resize a file smaller than the existing extents in use, so yes, restores aren't the only place that could cause confusion from the "incorrect" datafile names.
    Fixing it could be done in one pass if you don't mind adjusting filenames so they don't clash, i.e. shut down your database instance and move the files at the OS, startup mount and rename the files in the database.
    Don't use the services applet, the instance has to be shutdown with sqlplus, leave the database service running. If you try to open the database with OS files renamed but not corrected in the instance, the database won't open if there are troubles with the undo datafile.
    sqlplus /nolog
    conn /as sysdba;
      ... connected ...
    col name format a60
    col tsname format a10
    set lines 120
    select t.name tsname,  d.name, d.BYTES / 1024 / 1024 mb from v$tablespace t, v$datafile d where t.ts#  = d.ts#;
    system .../system.dbf  <n>
    shutdown immediate;
    ... database closed ...
    exit
    cd <datafile directory> 
    move sysaux.dbf undotbs01.dbf
    move UNDOTBS1.DBF sysaux.dbf
    # or use file explore GUI after shutdown
    sqlplus /nolog
    conn /as sysdba;
      ... connected to idle instance ...
    startup mount;
      ... SGA, instance size info ...
    alter database rename file 'C:\...<full path>\SYSAUX.DBF' to 'C:\...<full path>\UNDOTBS01.DBF';
    alter database rename file 'C:\...<full path>\UNDOTBS1.DBF' to 'C:\...<full path>\SYSAUX.DBF';
    select t.name tsname,  d.name, d.BYTES / 1024 / 1024 mb from v$tablespace t, v$datafile d where t.ts#  = d.ts#;
    ... make sure you get what was asked for ...
    TSNAME     NAME                                                       MB
    SYSTEM     C:\ORACLEXE\APP\ORACLE\ORADATA\XE\SYSTEM.DBF              360
    SYSAUX     C:\ORACLEXE\APP\ORACLE\ORADATA\XE\SYSAUX.DBF              660
    UNDOTBS1   C:\ORACLEXE\APP\ORACLE\ORADATA\XE\UNDOTBS01.DBF            25
    USERS      C:\ORACLEXE\APP\ORACLE\ORADATA\XE\USERS.DBF               100
    alter database open;
      ... database altered ... 

  • Oracle 11G - Oracle AWR export import Query Statistics.

    I have Oracle 11G, i have seen the sql statements through Historical AWR option from Top Activites in performance tab. Can i export all AWR query statistics from production machine so that i can analyze all logs after importing it.
    How can i know all statistical sql ( information ) and performace of production machine ?
    any help ?

    Hello,
    have you checked the DBA_HIST* objects to see what / how was imported?
    If the awr export dosn't get the contents of the rolling buffer, then you won't see any session statistics that are only there. If you want to get the contents of the rolling buffer you have to dump the contents of it with :
    oradebug setmypid
    oradebug dump ashdump 10
    and load it into your "test" database.
    But before doing this I suggest you read the related metalink documentation if any!!!
    Regards,
    Franky

  • Oracle 11g- Straing behaviour of query after importing from Oracle 10g

    Hi,
    I have a table in Oracle 10g as follows:
    Create Table xyz (col1 varchar2(50), col2 varchar2(50));
    With following Data
    Col1     Col2
    A     320
    A     110
    A     290
    A     380
    B     ABC
    B     256
    B     LMN
    I am running following Query
    select * from xyz
    Where Col1='A' and Col2=110
    It works fine. But when I export this table and import it in Oracle 11g. It says invlid identifier.
    But if I enclose 110 in single quotes. It works fine.
    Also If I recreate this table in Oracle 11g like
    Create table xyz1
    as select * from xyz;
    Now alos I am able to run this query smoothly.
    select * from xyz1
    Where Col1='A' and Col2=110
    What is wrong exporting this table from 10g to 11g.
    Any comments/suggestion??
    Aarbi

    The check in your where clause
    Col2=110Is comparing a string (Col2 is defined as a VARCHAR) with a numeric literal, so there will be an implicit conversion taking place from character to number. The query then fails due to the B LMN row when 'LMN' fails number conversion.
    I'm guessing there was there an index on the table in your 10g installation which would allow the query to be satisfied without checking the B ABC or B LMN rows but is not present or not used in the 11g installation so a full table scan results in an attempt to convert 'ABC' and 'LMN' to a number. Check the explain plans.
    Or it could even just be a difference in the order in which the two conditions in the where clause are evaulated between the two versions.
    The solution, as you have already found is to do a string comparision
    Col2='110'Edited by: Cyn on Dec 7, 2009 12:38 PM

  • Oracle 11G - Oracle AWR query execution time in report

    I have used AWR tool of oracle 11G. I have exported query historical statistics of production databaser using awrextr.sql and then load the exported dump file using awrload.sql script.
    Then i used awrrpti.sql and awrsqrpi.sql for generating report of sql queries. Every thing is working fine and generated reports are also very helpful, but report does not show the exact time when the query was executed. How can i get the actual time when the query was executed ?
    any help please ?

    If you would have consulted the Oracle Reference Manual to get the view descriptions, you should have your question is a rhetorical one with the answer NO.
    This is because every statement can be executed one or more times, and Oracle would need to keep track of all individual executions.
    I do agree most 'applications' do not use bind variables, and consequently only have unique statements, but Oracle didn't take that into account, and rightly so.
    Sybrand Bakker
    Senior Oracle DBA

  • Oracle 10g vs Oracle 11g query performance

    Hi everyone,
    We are moving from Oracle 10g to Oracle 11g database.
    I have a query which in Oracle 1g takes 85 seconds to run, but when I run the same query in Oracle 11g database, it takes 635 seconds.
    I have confirmed that all indexes on tables involved are enabled.
    Does anyone have any pointers, what should I look into. I have compared explain plans and clearly they are different. Oracle 11g is taking a different approach than Oracle 1g.
    Thanks

    Pl post details of OS versions, exact database versions (to 4 digits) and init.ora parameters of the 10g and 11g databases. Have statistics been gathered after the upgrade ?
    For posting tuning requests, pl see these threads
    HOW TO: Post a SQL statement tuning request - template posting
    When your query takes too long ...
    Pl see if the SQL Performance Analyzer can help - MOS Doc 562899.1 (TESTING SQL PERFORMANCE IMPACT OF AN ORACLE 9i TO ORACLE DATABASE 10g RELEASE 2 UPGRADE WITH SQL PERFORMANCE ANALYZER)
    HTH
    Srini

  • 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/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.

  • 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

  • Parallel  query in Oracle 11g

    We use Oracle 11g DB on windows2008R2.
    We wrote very long and heavy SELECT SQL query usign several table join and sub-queries and it take very long time to get result.
    We did SQL statement tuning as much as we can do so far. ( I will get the Execution Plan and ADDM, etc access right)
    I today notice about Parallel query function.
    Where could I write parallel hint phrases in very long SELECT SQL query ?
    In each selected tables like below ?
    /sample in Oracle Doc/
    SELECT /*+ PARALLEL(employees 4) PARALLEL(departments 4)
           USE_HASH(employees) ORDERED */ MAX(salary), AVG(salary)
    FROM employees, departments
    WHERE employees.department_id = departments.department_id
    GROUP BY employees.department_id;

    You need to be careful with some of the examples in the docs. The example you quote includes an unnecessary join. Before considering parallel query, it should have been re-written to this:
    SELECT MAX(salary), AVG(salary)
    FROM employees
    WHERE department_id is not null
    GROUP BYdepartment_id;
    Later versions of the CBO may do this re-write for you, but it is important to understand why the SQL is inefficient before throwing parallel servers at it. Are you sure that all your joins are actually necessary? (I know you are just going to say "yes", but you might want to think about it first.)

Maybe you are looking for

  • Can't "send" mail in Outlook Web App

    Firefox version 34 on Ubuntu Linux 12.04 Several users cannot "send" email using the Outlook Web App. I'm in the process of contacting Microsoft to see if the problem is on their end. The "send" button works fine in Chrome. I've tried: -Using the key

  • FreeAgent|Xtreme External Firewire Drive

    Does anyone know if this drive would work with my computer? Model Name: eMac Model Identifier: PowerMac6,4 Processor Name: PowerPC G4 (1.1) Processor Speed: 1.25 GHz Number Of CPUs: 1 L2 Cache (per CPU): 512 KB Memory: 1 GB Bus Speed: 167 MHz Boot RO

  • Which settings for 27" monitors?

    After setting up two new Maverick systems with 27" monitors (iMac 27" and MacBook Pro with 27" Thunderbolt Display), I find that some things are a bit difficult to read (labels, captions, some web pages and such). I have tried changing monitor resolu

  • Account Number  for customer - Urgent

    Hi Experts, What is the table and field name for Account number for Customer. Its possible to one account number have more than one customers. Thanks in advance. Points will be rewarded.

  • CS4 Creative Suite Standard Install Discs/Download?

    So unfortunately my macbook's harddrive just crashed, and with it many photos and applications, including my whole adobe CS4 creative suite standard (student edition).  My problem is that I no longer have the original install discs because my beloved