Function Index and Query Rewrite

Hi members,


I just stumbled on something that I've never thought of before.

It has to do with the function according to index and (possibly re - write query)

Here is my configuration:
SQL> create table tab1 (
  2    x   varchar2 (1)   default 'N' not null check (x in ('Y', 'N')),
  3    y   varchar2 (100) not null
  4  );

Table created.

SQL> create index tab1ix on tab1 (NULLIF(x,'N'));

Index created.

SQL> insert into tab1 (y)
  2    (select rpad (level,100,'x') from dual connect by level <= 1000);

1000 rows created.

SQL> insert into tab1 (x,y) values ('Y', 'Hello there');

1 row created.

SQL> commit
  2  /

Commit complete.

SQL> exec dbms_stats.gather_table_stats(user, 'tab1', cascade => true)

PL/SQL procedure successfully completed.
So, I created a small table with a FBI.

Now, let's use it.
The first is a query that obviously do not use it.
Second, one is a query that corresponds to the FBI.
SQL> explain plan
  2     set statement_id = 'st1'
  3     into plan_table
  4  for
  5  select * from tab1 where x = 'Y';

Explained.

SQL> 
SQL> select plan_table_output
  2    from table(dbms_xplan.display('PLAN_TABLE', 'st1','TYPICAL'));

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------

----------------------------------------------------------
| Id  | Operation         | Name | Rows  | Bytes | Cost  |
----------------------------------------------------------
|   0 | SELECT STATEMENT  |      |   501 | 51603 |     5 |
|   1 |  TABLE ACCESS FULL| TAB1 |   501 | 51603 |     5 |
----------------------------------------------------------


SQL> explain plan
  2     set statement_id = 'st2'
  3     into plan_table
  4  for
  5  select * from tab1 where NULLIF(x,'N') = 'Y';

Explained.

SQL> 
SQL> select plan_table_output
  2    from table(dbms_xplan.display('PLAN_TABLE', 'st2','TYPICAL'));

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------

----------------------------------------------------------------------
| Id  | Operation                   | Name   | Rows  | Bytes | Cost  |
----------------------------------------------------------------------
|   0 | SELECT STATEMENT            |        |     1 |   103 |     1 |
|   1 |  TABLE ACCESS BY INDEX ROWID| TAB1   |     1 |   103 |     1 |
|   2 |   INDEX RANGE SCAN          | TAB1IX |     1 |       |     1 |
----------------------------------------------------------------------

SQL> 
No worries, right?
Everything works as expected, when my predicate corresponds to the FBI, the index is used.


But here's what surprises me. It seems that the index expression is rewritten then it is created:
SQL> select column_expression from user_ind_expressions
  2  where index_name = 'TAB1IX';

COLUMN_EXPRESSION
--------------------------------------------------------------------------------
CASE "X" WHEN 'N' THEN NULL ELSE "X" END

SQL>
Questions are now, is this safe? -Does still work?

Can I trust the optimizer always did a rewrite such as performed when the index was created?


This index might live throughout the years and many versions of the optimizer. But the expression stays (I guess)

This is going into production this weekend, so I wanted to hear,
ideas / comments?


Best regards
Peter
SQL> select *from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE    10.2.0.3.0      Production
TNS for Linux: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
PS: NULLIF is nothing else than a syntactic sugar for the CASE expression equivalent?
docs say:
The NULLIF function is logically equivalent to the following CASE expression:

CASE WHEN expr1 = END expr1 expr2 THEN NULL ELSE
edited by: Peter on February 9, 2012 05:32

Hi Peter

In the docs for NULLIF, he said

The NULLIF function is logically equivalent to the following CASE expression:

CASE WHEN expr1 = expr THEN ELSE NULL expr1 END 2

http://docs.Oracle.com/CD/B10501_01/server.920/a96540/functions85a.htm
http://docs.Oracle.com/CD/B19306_01/server.102/b14200/functions102.htm
http://docs.Oracle.com/CD/E11882_01/server.112/e26088/functions116.htm

Which would explain the behavior you saw. As you pointed out, it is possible that the transformation of NULLIF expression BOX equivalent is likely to change? It seems unlikely - indeed, it seems to be an alias or a macro for the instruction box unless there is some way technically superior to implement this logic, it seems to be here to stay. Certainly, it has remained unchanged since the 9i.

Not sure how that helps.

David

Tags: Database

Similar Questions

  • Function index and virtual columns

    I just read the documentation of Oracle on the FBI. In the context of optimization with a function-based index, it is said that "a virtual column is useful for speed of access to data from expressions.". Here is the link Index-Organized Tables and indexes.

    My question is, does Oracle already not create a virtual column when we create a function-based index?

    Concerning

    Charlie

    Hi Charlie
    Yes, the database engine creates a virtual column. But this column is hidden. Reproduced in 11.2.0.3 example:
    SQL> CREATE TABLE t (n NUMBER);SQL> CREATE INDEX i ON t (round(n,0));
    SQL> SELECT column_name, hidden_column, virtual_column  2  FROM user_tab_cols
      3  WHERE table_name = 'T';
    
    COLUMN_NAME                    HIDDEN VIR
    ------------------------------ ------ ---
    N                              NO    NO
    SYS_NC00002$                  YES    YES
    

    HTH

    Chris Antognini

    Troubleshooting performance Oracle, Apress 2008/2014

  • Function index and user_tab_cols

    Why an entry is created in user_tab_cols when we create a function based on a column in a table?

    create table t1(a varchar2(100), b number); 

    select * from user_tab_cols where table_name = 'T1'; -- Two rows coming 

    create index idx1 on t1(upper(a));

    select * from user_tab_cols where table_name = 'T1'; -- Three rows coming

    What is the reason to put an entry in user_tab_cols?

    Martin Preiss wrote:

    If I remember correctly there is also a VIRTUAL_COLUMN attribute in % _TAB_COLS (at least since 11.1).

    Yes, there is, but how it would be useful to determine if the column is the index of based function related? All not stored in the disk column is a virtual column:

    SQL > create table (tbl)
    Number 2,
    3 the number n
    4                  )
    5.

    Table created.

    SQL > create index tbl_idx1 on tbl (abs (n));

    The index is created.

    SQL > alter table tbl
    2. Add n_ceil number generated always as (ceil (n));

    Modified table.

    SQL > alter table tbl change invisible n_ceil;

    Modified table.

    SQL > create index tbl_idx2 on tbl (n_ceil);

    The index is created.

    SQL > select column_id,.
    2 column_name
    virtual_column 3,.
    4 hidden_column
    5 to user_tab_cols
    6 where table_name = "TBL";

    COLUMN_ID COLUMN_NAME HIDDEN VIR
    ---------- ------------------------------ --- ---
    1 ID                             NO  NO
    2 N                              NO  NO
    SYS_NC00003$ YES YES
    N_CEIL YES YES

    SQL >

    As you can see, the two SYS_NC00003$ and N_CEIL are hidden, virtual columns. This part is the same regardless of the version. And in 12 c with the invisible support of solumn, you can't count on the id of null column. That's why (or at least one of the reasons) Oracle introduced another column in the view _TAB_COLS in 12 c - USER_GENERATED:

    SQL > select column_id,.
    2 column_name
    virtual_column 3,.
    hidden_column 4,.
    5 user_generated
    user_tab_cols 6
    7 where table_name = "TBL";

    COLUMN_ID COLUMN_NAME VIR HID USE
    ---------- ------------------------------ --- --- ---
    1 NOT ONLY ID YES
    2 N NO NO YES
    SYS_NC00003$ YES YES NO
    N_CEIL YES YES YES

    SQL >

    Now, we can say column SYS_NC00003$ is related FBI.

    SY.

  • How we force a query to use transparently a hint, even if the index is not given in the query as a query rewriting.

    How we force a query to use transparently a hint, even if the index is not given in the query as a query rewriting.

    For example:

    If the user runs a query select deptno, avg (sal) from emp group by deptno;

    We want the optimizer to use a hint of result_cache with this request, and it should be transparent to the user.

    Query should be rewritten to seamlessly

    Select / * + result_cache * / deptno, avg (sal)

    WCP

    Group of deptno;

    How can this feature we make? Please advice.

    I checked the possibility of SPM and contours, but it is not clear if this rewrite is possible here.

    Thank you and best regards,

    Vikas Krishna

    Surely dbms_advanced_rewrite is designed for this situation?

  • Indexing and the integrity constraint functionality difference

    Hello

    Sometimes I confuse me, how we can distinguish between indexing and the integrity of the features of constraint. Please let me know or if any available doc.


    Kind regards
    REDA

    I assume you mean unique vs unique index constraints?

    The sole (or Primary Key) constraints provide additional metadata that can be used by the optimizer.
    An index will be used to help the database to apply the constraint (it is created, or if there is it will be "captured" by coercion)

    Insofar as a document [url http://docs.oracle.com/cd/E11882_01/server.112/e25789/toc.htm] that's something, you should read

  • Function Index

    I'm reviewing an existing table in a database Oracle 11g and I do not understand a function based index that was created. The syntax is less than

    CREATE INDEX abc. Orders_Date on abc. ORDERS

    (CASE WHERE "ORDER_DATE" IS NOT NULL THEN "ORDER_DATE" ELSE NULL END)

    LOGGING;

    This table has about 90 000 lines with 32 000 values distinct order_date, 3000 lines have order_dates null. When you run a query on this table using the order_date column it makes a full table scan.

    What does this function index based? because I do not see how it adds all the required features

    Thank you

    As others have said, this index is actually right on order_date, however, is a core function so it cannot be used in queries that use CASES WHEN "ORDER_DATE" IS NOT NULL THEN END NO OTHER "ORDER_DATE."

    It is assumed that it might be possible that there is an index on (order_date) but it was found that it was used in the sql queries, which would have preferred to use other indexes. Some queries benefits so maybe that option based function was created as the sql must refer to the phrase exactly, requests that have received have been rewritten and others were left so that they could avoid the new index of the index.

    Of course, if this were the case then maybe you can take a look at your stats.

  • Function Index problem.

    Hello

    I have a problem regarding a function function index.

    example:

    TableName: Test

    Column: A, B, C, D

    I create the index on the table, column, a test using a user-defined function.

    If I do a select on the column, he'll be fine. In other words, I'll get the results you want.

    However, if I insert in the table and validation, and I do a query using the 'A' column in the where clause. I don't have any query hits. Its really weird.

    Have you ever experienced this problem? and is there an index of function according to back and donts w.r.t.?

    Thank you.

    MichaelR

    If you use a deterministic function really, it works:

    create or replace function test_fn (p_number number) return number deterministic
    is
      vreturn number := 0;
    begin
      if p_number = 1 then vreturn := 55; end if;
      if p_number = 2 then vreturn := 89; end if;
      return vreturn;
    end;
    

    Or, if you reverse the order of your second inserts (insert the folder before the recording of test1 test2) - it works fine.

    The reason why you get no results is when you insert the file test1 with a = 2, Oracle executes the function and gets no data, so it assumes that the result is NULL and puts in the index. You said Oracle function is deterministic, so he starts from the principle that any time test_fn (2) is called, it retrieves a null response.

  • SQL tuning advisor recommnds to create the function SYS_OP_C2C function index

    I have a large table and an index on it. I use a tool to fill data, this simple tool submits the sql for Oracle DB and it does NOT index to use for requests. When I run the sql tuning advisor, he recommends to create additional indexes and use the SYS_OP_C2C function, which I don't want.

    When I run the query through sql plus picks it up in the index.
    Someone of you came, why its recommend that additional nonsense?

    create index abc.xxxx on this_table (SYS_OP_C2C ("this_column"));

    Thank you

    The internal Oracle SYS_OP_C2C function perform the conversion of a set of characters to another set of characters - C (haracterSet) 2 c (haracterSet). There are situations where you will see this conversion without explicit, as in this case command that should be a sign that the data types are not the same and the implicit conversion takes place and this could also be a problem from the point of view performance because it can disable the use of the index.

    Make sure you the characterset and nls set of all of the database and the tool are the same.
    Make sure that the data type of the column in the index is the same as the database.
    Confirm the ETL vendor for your database support and fixes, etc..

    Optimizer will only advise to use this function when the data type or the character set does not match.

    Thank you
    Kerry

  • Why cannot avoid the sort ORDER BY STOPKEY function index

     
    
    SQL> alter session set nls_language=american;
    
    Session altered.
    
    SQL> create table test_sort(name,object_name) as select 'select',object_name from 
      2  dba_objects;
    
    Table created.
    
    SQL> create index i_test_sort_1 on test_sort(substr(name,0,3),object_name);
    
    Index created.
    
    SQL> exec dbms_stats.gather_table_stats(user,'TEST_SORT');
    
    PL/SQL procedure successfully completed.
    
    SQL> set autot trace
    SQL> select * from (select * from test_sort where substr(name,0,3)='sel' order by 
      2  object_name) where rownum<11;
    
    10 rows selected.
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 4202652051
    
    --------------------------------------------------------------------------------
    -------------
    
    | Id  | Operation               | Name      | Rows  | Bytes |TempSpc| Cost (%CPU
    )| Time     |
    
    --------------------------------------------------------------------------------
    -------------
    
    |   0 | SELECT STATEMENT        |           |    10 |   740 |       |   504   (3
    )| 00:00:07 |
    
    |*  1 |  COUNT STOPKEY          |           |       |       |       |
     |          |
    
    |   2 |   VIEW                  |           | 49902 |  3606K|       |   504   (3
    )| 00:00:07 |
    
    |*  3 |    SORT ORDER BY STOPKEY|           | 49902 |  1559K|  3928K|   504   (3
    )| 00:00:07 |
    
    |*  4 |     TABLE ACCESS FULL   | TEST_SORT | 49902 |  1559K|       |    60   (5
    )| 00:00:01 |
    
    --------------------------------------------------------------------------------
    -------------
    
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - filter(ROWNUM<11)
       3 - filter(ROWNUM<11)
       4 - filter(SUBSTR("NAME",0,3)='sel')
    
    
    Statistics
    ----------------------------------------------------------
            139  recursive calls
              0  db block gets
            279  consistent gets
              0  physical reads
              0  redo size
            695  bytes sent via SQL*Net to client
            400  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              5  sorts (memory)
              0  sorts (disk)
             10  rows processed 
    
    sql doesn't choose index ,so I use hint to force oracle choose index
    
    SQL> select * from (select /*+ index(test_sort) */ * from test_sort where substr(name,0,3)='sel'
      2  order by object_name) where rownum<11;
    
    10 rows selected.
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 1978014138
    
    --------------------------------------------------------------------------------
    ------------------------
    
    | Id  | Operation                      | Name          | Rows  | Bytes |TempSpc|
     Cost (%CPU)| Time     |
    
    --------------------------------------------------------------------------------
    ------------------------
    
    |   0 | SELECT STATEMENT               |               |    10 |   740 |       |
     22869   (1)| 00:04:35 |
    
    |*  1 |  COUNT STOPKEY                 |               |       |       |       |
                |          |
    
    |   2 |   VIEW                         |               | 49902 |  3606K|       |
     22869   (1)| 00:04:35 |
    
    |*  3 |    SORT ORDER BY STOPKEY       |               | 49902 |  1559K|  3928K|
     22869   (1)| 00:04:35 |
    
    |   4 |     TABLE ACCESS BY INDEX ROWID| TEST_SORT     | 49902 |  1559K|       |
     22424   (1)| 00:04:30 |
    
    |*  5 |      INDEX RANGE SCAN          | I_TEST_SORT_1 | 49902 |       |       |
       278   (1)| 00:00:04 |
    
    --------------------------------------------------------------------------------
    ------------------------
    
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - filter(ROWNUM<11)
       3 - filter(ROWNUM<11)
       5 - access(SUBSTR("NAME",0,3)='sel')
    
    
    Statistics
    ----------------------------------------------------------
              1  recursive calls
              0  db block gets
          22393  consistent gets
              0  physical reads
              0  redo size
            695  bytes sent via SQL*Net to client
            400  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
             10  rows processed
    
    From the explain ,the sql chooses the index,but SORT ORDER BY STOPKEY  doesn't avoid,so oracle
    must read all rows satisfy substr(name,0,3)='sel' ,the I rewrite the sql as the following,we can see 
    that sort ORDER BY STOPKEY does't happen,so oracle return 10 rows fast. 
    
    SQL> select * from (select /*+ index(test_sort) */ * from test_sort where substr(name,0,3)='sel'
      2  order by substr(name,0,3),object_name) where rownum<11;
    
    10 rows selected.
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 4154852915
    
    --------------------------------------------------------------------------------
    ---------------
    
    | Id  | Operation                     | Name          | Rows  | Bytes | Cost (%C
    PU)| Time     |
    
    --------------------------------------------------------------------------------
    ---------------
    
    |   0 | SELECT STATEMENT              |               |    10 |   740 |     8
    (0)| 00:00:01 |
    
    |*  1 |  COUNT STOPKEY                |               |       |       |
       |          |
    
    |   2 |   VIEW                        |               |    10 |   740 |     8
    (0)| 00:00:01 |
    
    |   3 |    TABLE ACCESS BY INDEX ROWID| TEST_SORT     | 49902 |  1559K|     8
    (0)| 00:00:01 |
    
    |*  4 |     INDEX RANGE SCAN          | I_TEST_SORT_1 |    10 |       |     3
    (0)| 00:00:01 |
    
    --------------------------------------------------------------------------------
    ---------------
    
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - filter(ROWNUM<11)
       4 - access(SUBSTR("NAME",0,3)='sel')
           filter(SUBSTR("NAME",0,3)='sel')
    
    
    Statistics
    ----------------------------------------------------------
              1  recursive calls
              0  db block gets
             11  consistent gets
              0  physical reads
              0  redo size
            695  bytes sent via SQL*Net to client
            400  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
             10  rows processed

    Jinyu wrote:
    Hi, I think that this may be an optimizer bug 10g or flaw optimizer 10 g, although substr (name, 0, 3) = 'salt' is not selective, but oracle can also use indexes to find the top 10 by object_name result order

    Jinyu,

    Indeed, it seems to be a gap in the mode of optimization 10.2 FIRST_ROWS_n. I could reproduce your problem in 10.2.0.4 and watching the 10053 trace, it looks like that the optimizer does not consider the option "Recost for ORDER (with the HELP of indexes)" where you have a composite index based function. It does when using a 'normal' composite index, and it does - as you mentioned - when using the main column in the ORDER BY expression as well. You don't need to use INDEX indicator in this case, moreover, the recosting for ORDER BY then works very well and chooses the index without specified indicators.

    11 g the "recalculate for ORDER BY" appears again in the first place it looks like an obvious limitation / bug of 10.2.0.3/4 at least.

    Kind regards
    Randolf

    Oracle related blog stuff:
    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/

  • Indexing and who should do it

    I work for a company that has a fairly large data warehouse Oracle that we use to store the SAP data dissemination (about 500 M of lines for some tables). Tables are not indexed and if I try to reach them on the query takes hours to complete. If the DBA needs to be proactive and create these indexes in order to reduce the load on the database?

    The team wants to load our 40 hours for 3 indices Department ADMINISTRATOR has already provided a script for. I'm naïve or y at - it something crazy to need 40 hours to implement 3 clues? I should mention that these tables is related to SAP and should be indexed to joined already IMO.

    I'm just trying to understand if I'm missing something.

    Thank you

    Creation of parallel indexing can reduce your time to create, but you must "alter index noparallel xyz" after its creation if you want really not parallel to this topic.

    Another impact on the creation of index how long does is how fast your hardware (processors, processor speed, speed of SAN etc.), but also what else is no running on the database in time using server resources.

    On an AIX Power 7-3 processor (quad core) production server it took me about 15 minutes to create an index on a table of 600 million lines running at the same time 8.

    On an AIX Power 5-4 Intel (quadruple-heart) test server it took about twice as long.  The SAN on production was super fast as well which had impact on how long it took.

    There are other factors that will affect the creation time.

    Specifically that I seriously doubt they can justify bill you for 40 hours.  It is unlikely that someone will run a script and then watching the screen for the next 40 hours waiting for the index to create... unless they are a bunch of clowns.  More than likely they run the script, go and do other things and periodically check to see if she has completed.

    Your IT team is having a laugh.  It should be fun to ask them to justify and to break the 40 hours.  minute to copy the script on the server, 30 seconds to go, 30 seconds to run the script.  39hrs, of 58 minutes watching the screen ready to create index at the end... Hmm... sounds fishy to me.

  • Are there patches IE11 and Chrome for RoboHelp for Word 10? Table of contents, Index, and search do not work as expected in WebHelp...

    Question:

    Fixes IE11 and Chrome on the Adobe web site ask you to put their new files in RoboHTML templates_stock folder. However, I need these fixes for RoboHelp for Word. Is there a such difficulty?

    Background:


    I use 10 RoboHelp for Word, generating WebHelp.

    I try to solve the problems about the table of contents, Index, and search appears not not or not being not completely functional IE11 or Chrome, not including many of our customers use. I found a couple of workarounds that my boss doesn't like.

    • In IE11, if the end user adds the web site to the compatibility view list, they all appear and function correctly, but my boss is adamant about not wanting the end user having to do anything to solve the problem.
    • In Chrome, I can get a table of contents and a non-functional search to appear if the user turns off JavaScript for the site, but this solution also violates the lists see also in help. Again, made my boss wants to not that the end user to have to do.

    His solution is just to generate using pure HTML, but then the search won't work in IE11 or Chrome (I'm not sure about Firefox). I are based largely on the research, when I'm working on the product, so I really don't want to lose the search function.

    Help, please.

    Kind regards

    Jenn

    As I said in my reply to your message in the RoboHelp for Word forum, there is no patch for this.

    I can understand your not wanting to Manager end users will do anything and agree with him. However, the fixes for these issues in HTML HR are simply not available in RoboHelp for Word.

    See www.grainge.org for creating tips and RoboHelp

    @petergrainge

  • spatial index and normal index

    Hi space specialists,.

    I have a question for spatial index performance and how Oracle manages queries that have a space and regular condition combined. We are on the Oracle 10 g Enterprise Edition Release 10.2.0.4.0 database

    Take a query like this one (not a real query but based on the type of query that is generated by ArcGIS):

    Select objectid

    attribute

    geometry

    table

    where mdsys.sdo_filter (geometry, mdsys.sdo_geometry (: gtype1,: srid1, null,: elem_info1,: ordinates1), 'querytype = window') = 'TRUE '.

    and attribute = value

    In our scenario, we have a lot of rows in the table (2 million), but we have only a few lines (2000) where attribute = value.

    It seems that there is a scenario where the performance is really bad. It takes 5 seconds for the query to return the results and you're just too slow for our needs. There is a spatial index on a geometry and a normal index on the field for the attribute. The plan of the explain command shows that both the spatial index and the index of the attribute are used.

    Of course, we can break to the top of the table in separate tables by object type. This would make the index space datamodel much more efficient, but at the expense of our current simple, abstract.

    Do you have suggestions on how we can improve performance without too much impact on our datamodel? Oracle for example has an option where you can create a spatial index on a subset of the data in a table?

    Thank you!

    Rob

    Do not know whether or not the following works for your case:

    use the column range-key attribute to create a partitioned table Beach and then create a local spatial index.

  • Function returning the query takes longer to run in Apex4.0

    Hi all

    I've created a report using the function returns the query. The function returns the query based on parameters that returns the dynamic columns. When I run the query in sql developer the query generates and returns the result in 3mins. But in the apex, it takes 35 minutes maximum to return.

    The query returns about 10000 lines.

    What a performance problem in the query or Apex? can someone help plz

    Concerning
    REDA

    No it's just the first tranche of 500. You can run it in good old SQL * more and the total time of the time (be patient however)

  • use of query rewriting

    is there a way to connect the materialized views how often are accessible in general or by the query rewriting enabled option?

    I would like to know what materialized views are useless, because they are never used by query rewrite.

    You can follow with select audit, good example here

    http://www.Oracle-base.com/articles/10G/auditing-10gR2.php

    If you want to in retrospect you may need something cludge together by hitting the v$ sql and plans to even see who has several SQL identifiers have a plan that rewrite. not good enough.

  • ORA - 29857:Domain index and objects secondary exists in Tablespace

    Database: 10.2.0.4
    OS: Windows

    While dropping the tablespace, I'm getting ORA-29857.
    I understand that I must remove indexes of area on the tablespace, and also to find secondary objects in this tablespace and drop them.


    Please provide me with step by step troubleshooting (query) for this error.



    Thank you
    Alok

    damorgan, one of our As Oracle answered this question even a couple of years. He is Director of Oracle ACE and Oracle self-taught over 12 years at the University level - http://www.morganslibrary.org/)

    ORA-29857: domain indexes and/or secondary objects exist in the tablespace

    As he hinted after the accurate results of the applications after using the name of your tablespace

    SELECT * FROM v$version;
    
    SELECT COUNT(*)
    FROM dba_segments
    WHERE tablespace_name = 'yourTableSpaceNameHere';
    
    DROP TABLESPACE yourTableSpaceNameHere INCLUDING CONTENTS AND DATAFILES;
    

    This query will show you the objects

    SELECT owner, segment_name, partition_name, segment_type, segment_subtype, relative_fno
    FROM dba_segments
    WHERE tablespace_name = ''yourTableSpaceNameHere'';
    

    Those are the objects that you will lose if you drop the tablespace.

Maybe you are looking for