Index of feature based using SYS_XQSUBSTRAFT

running on 11.2.0.2

I was wondering if this could be a recommended approach to use SYS_XQSUBSTRAFT in a FBI to satisfy a xmlquery using substring-after on a column in a xmlquery? I test, and the optimizer uses the index, but don't know if I'll run into problems in later versions of the Oracle, if/when xmlparser and rewrite engine is updated?

I am selecting from the relational tables using fn:collection (with xmltype xml binary column) and must instr of relational columns in the context of xmlquery... running an explain plan on my query revealed that substring-after has been rewritten to call the SYS_XQSUBSTRAFT function.

Thanks for the tips

I was wondering if this could be a recommended approach to use SYS_XQSUBSTRAFT in a FBI to satisfy a xmlquery using substring-after on a column in a xmlquery?

Well, initially I would have said it's a bad idea, because Oracle has always insisted on not depend on the underlying implementation.

However, it's OK to use XMLQuery in a FBI, like this:

SQL > create table sample_data (str varchar2 (7));

Table created.

SQL > start

2

3 insert into sample_data values (' ABC 123' ");

4 insert into sample_data values ("XYZ-123'");

5 insert into sample_data values (' ABC-456' ");

6 insert into sample_data values (' ABC-789' ");

7

8 end;

9.

PL/SQL procedure successfully completed.

SQL > commit;

Validation complete.

SQL > create index sample_data_ix1 on sample_data)

() 2 xmlcast

3 xmlquery ('substring-after($str, "-")"incidentally as 'str' content return str)

4 as varchar2 (4000)

5    )

6  );

The index is created.

SQL >

SQL >

SQL > set lines 200

SQL > define pages 100

SQL > set autotrace on explain

SQL > select xmlquery)

2 ' for $i in fn:collection("oradb:/DEV/SAMPLE_DATA") / ROW

3 where substring-after($i/STR, "-") = "123".

4 return $i"

5 content of return

(6) as a result

7 double;

RESULT

------------------------------------------------------------------------------------------------

ABC-123 XYZ-123

Execution plan

----------------------------------------------------------

Hash value of plan: 2484218877

------------------------------------------------------------------------------------------------

| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

------------------------------------------------------------------------------------------------

|   0 | SELECT STATEMENT |                 |     1.       |     2 (0) | 00:00:01 |

|   1.  GLOBAL TRI |                 |     1.  2007 |            |          |

|   2.   TABLE ACCESS BY INDEX ROWID | SAMPLE_DATA |     1.  2007 |     2 (0) | 00:00:01 |

|*  3 |    INDEX RANGE SCAN | SAMPLE_DATA_IX1 |     1.       |     1 (0) | 00:00:01 |

|   4.  QUICK DOUBLE |                 |     1.       |     2 (0) | 00:00:01 |

------------------------------------------------------------------------------------------------

Information of predicates (identified by the operation identity card):

---------------------------------------------------

3 - access (SYS_XQSUBSTRAFT("STR",'-') = '123')

Note

-----

-dynamic sample used for this survey (level = 2)

And the funny thing is that Oracle has in fact already rewritten index function:

SQL > select dbms_metadata.get_ddl ('INDEX', 'SAMPLE_DATA_IX1') of double;

DBMS_METADATA. GET_DDL ('INDEX', 'SAMPLE_DATA_IX1')

--------------------------------------------------------------------------------

CREATING INDEX 'DEV '. "' SAMPLE_DATA_IX1 ' ON 'DEV '. "" SAMPLE_DATA "(SYS_XQSUBSTRAFT ("))

((STR','-'))

PCTFREE, INITRANS 10 2 MAXTRANS 167 COMPUTE STATISTICS

STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645)

PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS USER_TABLES 1, DEFAULT FLASH_CACHE

FAILURE BY DEFAULT CELL_FLASH_CACHE)

TABLESPACE 'USERS '.

so I guess that your approach is OK, in principle.

Now, I'm wondering no doubt creating an XML related on a pure relational table index.

Have you thought about using SQL/XML XMLElement, XMLAgg etc. instead of fn:collection() features and send it to your main XQuery?

Tags: Oracle Development

Similar Questions

  • Where do I put the AutoFill feature when using Firefox?

    You people do a great job of describing 'How to use Auto Fill'... but nowhere in this article does say WHERE - to implement the feature when using Firefox.

    How and where can I find the setting?

    Thank you.

    PS: maybe that should be in the article somewhere.

    What about filling the data in a form (input field) on a web page?

    See:

  • index on the column using custom function

    Can we create index on the column using custom function?

    http://www.dbasupport.com/Oracle/ora8/FBI.shtml

    Kind regards
    Kaila Mahesh

  • How better to insert a subarray (line) in a 2D array to the correct index which is based on the value of the first column

    Hello

    I would like to insert a subarray (line) in a 2D to the correct index table. The position is to say the index value depends on the value of the first column of the table 2d.

    As an examlple my 2d array would look like this

    230 50 215 255

    300 60 270 330

    360 20 350 370

    And I would like to insert another line (subarray) with the following values

    320 40 300 340

    This new line should be placed between the second and third rows (this is based on the first column only).

    I tried the threshold 1 d function table by taking an 1Dsub array of my 2d array (first column), then using the first of the new line (320) as the threshold. It sort of work, but it does not work when I start the table (IE there is only 1 row) and it seems to not work properly on other occasions (as explained in the help of Labview).

    Hopefully the explanation is clear enough for any suggestion. Thanks in advance for the help!

    JTRI wrote:

    The idea is I have start with a new table and add these lines in the right order every time that the user sets the values Jack

    Ahh, so try this.

    This will also work with an empty array.

    You want to do with this function it is a Subvi.

    Make the entries 'table' and 'subarray"on the connector, then 'new array' output.

    You can then put this Subvi in a loop with a registry to shift and it will help to add new lines in a sorted order, when they are added.

    That is what you were aiming for?

  • Build indexes of text based on a list of words or phrases.

    I'm a bit of a newbie to this full-text indexing. I was able to build and query an index of simple text and even set up my own list of stopwords. However, I would like to be able to control the set of words that are indexed.

    For example, if I have a table that contains a CLOB field full of text documents and I also have a list of 200 words:

    "TUBERCULOSIS".
    "DIABETES".
    "CHEMOTHERAPY".
    ...

    I can generate an index that only indexes the words on this list and does not take into account all the other words? (the inverse of the use of a list)

    Also, it could be done with a list of phrases instead of single words:

    "CARDIAC ABLATION.
    "ATRIOVENTRICULAR NŒUD.
    "LUNG ABSCESS.
    ...

    Thank you.

    You don't need to store a copy of the document that I did in the example. If you have a unique identifier, such as a numeric primary key associated with the document, you can store that instead and joining the table with the document when you need to.

  • Index of table based on the value

    Is there a built-in method to get the index of an array of \n by its value (JSX). It seems that indexOf does not work here as in javascript...

    FWIW, here is the implementation recommended by Mozilla (which has a more robust error checking):

    if (!Array.prototype.indexOf) {
        Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
            "use strict";
            if (this == null) {
                throw new TypeError();
            }
            var t = Object(this);
            var len = t.length >>> 0;
            if (len === 0) {
                return -1;
            }
            var n = 0;
            if (arguments.length > 0) {
                n = Number(arguments[1]);
                if (n != n) { // shortcut for verifying if it's NaN
                    n = 0;
                } else if (n != 0 && n != Infinity && n != -Infinity) {
                    n = (n > 0 || -1) * Math.floor(Math.abs(n));
                }
            }
            if (n >= len) {
                return -1;
            }
            var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
            for (; k < len; k++) {
                if (k in t && t[k] === searchElement) {
                    return k;
                }
            }
            return -1;
        }
    }
    
  • index of dynamic query uses

    I forgot how to use sql and Oracle dynamic index was linked.

    For example I would like to have the query like this:
    open v_search_results for
       'select * from T1, T2, ..., TN
        where T1.Col1 = ....
              and ...
              and TN.ColM like ....
        ';
    (Please note that I have the query as a string inside the symbols apostrophs.)

    Suggest I index on the columns of the tables T1, T2,..., TN.
    These indices are used if someone now opens the cursor "v_search_results" variable to retrieve these data? Or the engine database ignores indexes in dynamic queries?

    Execution plan will not change between static and dynamic SQL. It's all SQL for oracle. If the CBO decides if the use of the Index is the right thing to do so it will use.

  • It's a good idea to create an index on a column used for partitioning

    I'm new to using partitions as well as the index. Can someone help me with the situation below?

    I have a table defined as below


    CREATE TABLE FACT_MASTER
    (
    PERIODCODE NUMBER (8) NOT NULL,
    PRODUCT_CD NUMBER (10) NOT NULL,
    DPT_CD NUMBER (3).
    FACT_VALUE1 NUMBER,
    FACT_VALUE2 NUMBER,
    FACT_VALUE3 NUMBER,
    .....
    .....
    .....
    .....
    .....
    FACT_VALUE50 NUMBER
    )
    PARTITION BY RANGE (PERIODCODE)
    (
    partition P1 lower values (2002),.
    partition P2 lower values (2003).
    lower partition P3 values (2004),
    ...
    ..
    )

    This table is partitioned on the shop period code.

    In a select query on the table, period code and product code are used. I intend to create an index to improve performance. Does make sense to include the period code column in the index? I intend to create indexes only for the product code column. I think that the partition itself behaves as an index for periodcode. Can someone tell me if this is correct? I use 10g.

    Published by: user6794035 on January 21, 2010 08:47

    Published by: user6794035 on January 21, 2010 08:50

    If the index is an overall index, then yes it is worth including. But check that your SQL would actually benefit an overall index.

    If your period still code in SQL, then the partition pruning will natuarally and would therefore not be required to be part of the index!

    P;

  • creating a unique index of instaed of using the primary key index

    Hello

    I heard in a debate sometimes it is better to create a unique index on a column and use it instead of using the primary key index in oracle. I did not understand what that the reason propely.

    Can someone please help me in this topic if it is valid.

    Thanks in advance

    On the surface, which does not seem reasonable... Volume of the DML is irrelevent to determine which column is the primary key for a table.

    My wild speculation a bit at a reasonable time could someone do...

    If you use synthetic primary keys (i.e. the keys generated by sequence) and that your tables are subject to large volumes of inserts such as there is a danger that the block "to the right" will be the source of contention block and worry not about analysis of beach on the column, you can create a reverse on this column (unique or non-unique) key index before creating the primary key constraint and to indicate Oracle to use this existing index to respect the primary key constraint.

    Obviously, however, this involves a lot of assumptions to arrive at a reasonable point. There may well be another set of assumptions that could also lead to a valid argument. Or it could be a myth that someone has heard and just repeats.

    Justin

  • Two features I use while online just stopped working - wtf?

    In the last two days, there has been two changes in the use of my laptop, and I wonder if you have no idea about them. I don't know if they have nothing to do with each other except that they started at the same time. Also, I don't know if they have something to do with Firefox.

    1. all of a sudden the Wireless does not work for the transmitting radio. I've always been able to unplug my laptop and take in the kitchen, for example, to listen to the end of a show, while I cooked. Now, a few seconds after disconnecting (even if I'm not moving it), the transmission stops.

    2 all of a sudden I can't drag images to download. It is true that I am on Google Image search, Flickr or Facebook. As with the #1, I was always able to do this easily, and then a couple of days, I couldn't do more.

    The only change that I made recently is to download the module RealDownloader 1.3.3 FF (and perhaps RealPlayer?)

    Any ideas?

    Thank you

    Lily

    I have taken the battery then put it again, and I have my wireless back!

  • I have a problem with some Web sites where all the content load aligned on the left side, and some of the boxes or buttons do not appear. Should what features I use to see correctly?

    Some pages do not appear like they should, I think my computer may have stopped some features when I updated my avg antivirus.

    I have a screenshot here.
    http://www.freeimagehosting.NET/newuploads/06516.jpg

    Thank you.

    Reload Web pages, and ignore the cache.

    • Hold SHIFT and click reload.
    • Press 'Ctrl + F5' or 'Ctrl + Shift + R' (Windows, Linux)
    • Press 'Cmd + Shift + R' (MAC)

    Clear the cache and cookies from sites that cause problems.

    "Clear the Cache":

    • Tools > Options > advanced > network > storage (Cache) offline: 'clear now '.

    'Delete Cookies' sites causing problems:

    • Tools > Options > privacy > Cookies: "show the Cookies".

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > appearance/themes).

    See also:

  • I just bought everything in one6520. What do I need to plug the wireless feature to use the machine?

    I just purcahsed the 6520 printer all-in-one. Really need not part the pkg wireless but wiil I still have to configure it to use the basic print/copy/scan?

    Hello

    For a computer, simply connect via USB to get the AIO printer functions.

    Kind regards.

  • Turn on windows features, either & using Ctrl + Alt + Delete to log on

    I tried to view the .xps file, but I can't even if I had netframework3, which include the xps Viewer, and I tried to turn it on but then follow instructions, I can't find programs in Control Panel, I have to do?
    Also, I want to use alt + ctrl + del to log on, but I can't activate it because I've not found advanced in my user account window, what I have to do?
    Thank you

    Because these instructions are for Windows Vista or Windows 7.  Have a look here...

    http://www.mydigitallife.info/2007/01/27/how-to-open-view-or-create-XPS-documents-in-Windows-XP-and-Windows-2003/

    --
    Gina Whipp
    2010 Microsoft MVP (access)

    Please post all responses on the forum where everyone can enjoy.

  • I have a problem in the 3D feature, I use Photoshop CC 2015

    Hello

    I use Photoshop cc 2015, I have a very unusual problem, I make models 3d for the Web site portfolio, when I paste screen runs in Photoshop and 3D-click > New #d selection layer Extrusion, you can see the photo in the url http://prntscr.com/9n1obh, my web image convert into dark http://prntscr.com/9n1pd3 instead It should be shaped real http://prntscr.com/9n1pma

    Please reset the Photoshop preferences to default.

    Steps to follow:

    To re-create the Photoshop preferences files, start the application while pressing Ctrl + Alt + Shift (Windows) or command + Option + shift (Mac OS). Then, click Yes to the message, "Delete the Adobe Photoshop settings file?"

    Kind regards

    ~ Mohit

  • Get rawvalue (index) of the Listbox using FormattedValue

    I have two drop-down menus with two different sets of data. a country and another with the profession.

    I have a listbox with all the possible country/profession together to form a formattedvalue. How can I get the rawvalue/index with the formattedvalue of two fields above.

    I will choose a country in particular and profession and then I need to get the index of this combo in the listbox.

    Any help would be appreciated.

    I solved my problems. Here is the code I have developed to do the job. It could be simplified a bit further, but it worked fine.

    I put it in the action of the entry.

    checkValue .rawValue = var [dropdown1]+ [dropdown2].formattedValue + «,»

    oArr var = checkValue.split (",");

    oList var = xfa.resolveNode (.somExpression[listbox with the values of index and concat]);

    var oListIndex;

    While {(oArr.length!=0)}

    oListIndex = oList.boundItem (oArr.pop ());

    oList.setItemState(oListIndex-0,1);

    }

    NOTE: You can add if statement to make it work only if these fields have values just before while the State.

Maybe you are looking for

  • / System/Library of the El Capitan initialization process

    Hello When I list all processes that are running on my mac os session, it shows me tons and tons of process/System/Library, associated with "Image Capture", "AOSKit", etc. Is this normal? I did not remember to initialize? I only Chrome, BetterTouch,

  • I have a metro Firefox supports those phone

    I have an account with Metro PCS I just want to know if firefox supports Kyocera?

  • How to save the string in a file with some special characters

    Hello I m using MD5 - llb to create a password. So, I want to save this MD5-string to a file and read it later abd compared again. Works perfectly with a proplem: Some Word create a '\r' in the string of MD5 and when I save this string in a file and

  • HP desktop computer - 110-417c (ENERGY: new black computer screen)

    Desktop PC MODEL 110-417 c (ENERGY STAR) I have struggled with this computer from day one. I like to play games on the candy booth, as I brought this pice of shi #t I can't play more. I discovered that I couldn't update. I ask: P help. my computer is

  • How to restore a used computer?

    Original title: Restore my computer.OK my work was closing down and away portable givving old was there and I had one, but now I have no way to connect and I need dry completely and make it like new. Can someone help me?