Bind Peeking only for columns 'known '?

Hi all

We are working on our 11.2.0.3 database RAC (on AIX 7.1) to try to understand why a certain repeated (batch load) does not use the correct execution plan.

The query itself looks like:

Select the CATENTRY CATENTRY_ID where ((PARTNUMBER =: 1) GOLD ((0 =: 2) AND (PARTNUMBER IS NULL))) and ((MEMBER_ID =: 3) OR ((0 =: 4) AND (MEMBER_ID IS NULL)));

This query is a query internal IBM Webshere, that is immutable.

The table in question has an available on PARTNUMBER & MEMBER_ID index

The execution plan looks like however

The execution plan of the above statement looks like:

Execution plan

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

0 SELECT optimizer Mode STATEMENT = ALL_ROWS (cost = 2038 card = 1 bytes = 23)

1 0 TABLE ACCESS FULL WCSADMIN. CATENTRY (cost = 2038 card = 1 bytes = 23)

Then a FTS scanning is used where expect an Index seek.

The values passed to this application are for example:

: 1 = XA-GOL-1068849

: 2 = 1

: 3 =-6000

: 4 = 1

With the part of the WHERE CLAUSE then having ((0=1) AND (PARTNUMBER IS NULL)) and ((0=1) and (MEMBER_ID IS NULL)) would be give rise to an Index seek.:

Select

catentry_id

of catentry

where ((partnumber = «XA-GED-5702810'))

or ((0 = 1)

"and (partnumber is null)))".

and ((member_id = - 6000)

or ((0 = 1)

and (member_id is null)));

Execution plan

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

0 SELECT optimizer Mode STATEMENT = ALL_ROWS (cost = 3 cards = 1 bytes = 23)

1 TABLE ACCESS BY INDEX ROWID WCSADMIN 0. CATENTRY (cost = 3 cards = 1 bytes = 23)

2 1 INDEX UNIQUE WCSADMIN SCAN. I0000064 (cost = 2 = 1 card)

Somewhere in the analysis of the query optimizer does not have / use all of the information needed to determine the correct plan, although the trace file shows all the values are correctly captured

I expect that the optimizer would be "PEEK" all the available variables to determine the best execution plan.

It seems however that both binds to the "0 =: 2" and "0 =: 4"are not "read" and therefore not used, resulting in a full Table Scan as the PARTNUMBER IS NULL and MEMBER_ID IS NULL are not ignored. "

Can someone confirm that binds only for columns ' existing/real' is to take a look?

And is it configurable?

Thank you

FJ Franken

It's an interesting question - at first glance, it seems that Adaptive cursor_sharing should be able to solve your problem.

However, I think that the optimizer must produce a plan that will be THAT ALWAYS produces the correct result regardless of the actual values provided. Your application may require the optimizer to find rows where memberid and partnumber are null, and you index (probably) is not a required column in it then the only legal execution plan given that complete analysis.

According to the relative frequency of values and the number of NULL values for each column, you may find that the generic solution (rather than the index only solution that you got for this specific request) is to create an index on (partnumber, member_id, 1) or (member_id, partnumber, 1) then the optimizer can use CONCATENATION to choose one of the two alternative ways.

Concerning

Jonathan Lewis

Tags: Database

Similar Questions

  • ORA - 01461:can bind a LONG value only for insert in a LONG column. After upgrade to 11g

    After update, oracle 11g, we get the system error when you try to insert the text string in the NCLOB type column.

    ORA - 01461:can bind a LONG value only for insert in a LONG column.

    This has not happened on an earlier version of Oracle.

    I did some testing and found that, if a string more then 2000 we get this error.

    How to solve this problem?

    Thank you

    I found a solution. I had to update ODP.NET to 2.112.1.0 version.

  • A weird exception in 12 c (ORA-01461: can bind to a LONG value only for insert into a LONG column)

    I have a Windows application that accesses a database of 12 c Oracle via ODBC (driver version is 12.01.00.01).

    I have a table with a column of key named REGION_ID (NVARCHAR2 (9)) and a dozen other columns, of which three are named region1 and region.2 elle3, all of type NVARCHAR2 (40).

    When I try to insert a string in the scope of the region1 is longer than 9 characters (length of REGION_ID), I get an error ORA-01461 (' can bind to a LONG value only for insert into a LONG column). If I set the length of REGION_ID be NVARCHAR2 (15), so I can add channels to the region1 in length up to 15 field until I get ORA-01461 exception again. Curiously, if I change the name of column region1 to REGIONONE, I don't get any errors, and everything works fine. It's almost as if the column name region1 is being confused with REGION_ID backstage.

    Any ideas? I am using SQLBindParameter to bind the columns, and all calls are successful. I get the exception when I run the insert statement. This same code worked for previous versions of Oracle (9i, 10g and 11g). And if I use a driver of client 11g against the 12 c server, I do not receive the exception.

    Thank you!

    It is a component of ODBC driver bug in 12 c and it is fixed. You can download and install the fix for bug 18232462 or the last window for 12 c patch cumulative/bundle.

    Thank you

    Spengler

  • ORA-01461: can bind to a LONG value only for insert into a LONG column

    Hello

    Oracle XE on RHE dedicated server
    create table cvDetails(
    cd_id number(14) primary key,
    cv_id number(14) constraint education_fk references CvProperties(cv_id),
    nationality varchar2(230),
    objectives varchar2(3900),
    name varchar2(230),
    fatherName varchar2(230),
    motherName varchar2(230),
    dob varchar2(230),
    gender varchar2(230),
    mStatus varchar2(230),
    passportNo varchar2(110),
    email varchar2(230),
    phone varchar2(45),
    mobile varchar2(25),
    address varchar2(2500),
    state varchar2(230),
    zipCode varchar2(230),
    city varchar2(230),
    education clob,
    experience clob,
    skills clob,
    languages varchar2(1400),
    hobbies varchar2(3200),
    achievements varchar2(3900),
    references varchar2(3900)
    );
    
    create sequence cvDetails_seq
    start with 1 increment by 1;
    
    create or replace trigger cvDetails_trig
    before insert on cvDetails
    referencing new as new
    for each row
    begin 
    select cvDetails_seq.nextval into :new.cd_id from dual;
    end;
    /
    Why do I get the error of subject?

    Thank you in anticipation

    >
    in any case, I checked manually according to your instructions and found that this objective column is of character input more than specified.
    >
    Glad you found the problem, but I hope that you learned a lesson that is time consuming.

    It must be remembered that we have no access to your environment. If we do not know which servers, clients, tables and users that you use.
    It may seem simple to you but doesn't realize that you provide us with two slightly different versions of the cvDetails table.

    The original post had this
    >
    objectives varchar2 (3900).
    >
    But when you have provided your 'cvDetails desc' journal text has
    >
    OBJECTIVES VARCHAR2 (3950)
    >
    It is the same table that you started with how the column suddenly grow 50 bytes?
    This means that you did from different parts of the present in the two schemas or on two servers or you change the table between the two.

    You can't address properly when you do this. By chance it is the column that you said is now the problem.
    In SQL, the maximum length of a VARCHAR2 is 4000 bytes; no characters but bytes. Nothing more than 4000 bytes would probably be a LONG in the generic sense.

    If your error
    >
    Re: ORA-01461: can bind to a LONG value only for insert into a LONG column
    >
    means that you try to 'bind a LONG value' to a column VARCHAR2 and you can't you can 'bind a LONG value only for insert in a LONG column.

    In the proper context, the error makes sense.

    You probably have a problem with

     ps.setString(2,  objectives);
    

    because the 'objectives' has a length of more than 4000 bytes.

    Remember this answer from you?
    >
    I have read and found that there may be a problem with the driver JDBC or Characterset. Am I wrong?
    >
    The 'Hello' ASCII string is five characters and five bytes because the ASCII code is a set of characters in a single byte. The same string internally in Java is five characters but ten bytes because Java uses UTF16.

    So, if the character set of the data itself is double-byte character set then anything more than 2000 characters (4000 bytes) is a "LONG". And if your column is defined as VARCHAR2 (3950), which means bytes a doublel-byte character set which are characters of 1975.

    Then you said in a response later
    >
    I checked by the SNA Server and oracle that are both of the same but new thing I found is that oracle does not allow more than one clob column in a table. Is this true?
    >
    Somehow a hypothesis has crept it that the problem was not a driver JDBC or Charaterset, but because you can not have more than one clob column in a table.

    You could have easily tested for yourself by doing what P. Forstmann - tried to create a table and see.

    Then you completely ignored my advice
    >
    I suggest to you isolate the columns actually causing the problem.
    Change your code to insert only a few columns. When it works, add more than a few columns.
    This will then tell you which column or the columns are at the origin of the problem.
    Display the results once you determine a column that causes the error.
    >
    When you have finally made the simplest things, you have found what was causing the problem almost immediately.

    Many times you don't need 'experts' - you must use a rigorous, methodical, process step by step.

    ALWAYS, ALWAYS, ALWAYS reduce the simplest possible code example that illustrates the problem.
    If you had followed this a rule would have probably found you the problem and makes you look like the 'expert '.

    There are no shortcuts.

  • can we create an index only for a given value in a column?

    desc TAB_A
    -----------------
    id1  Number Primary key,
    id2  Number,
    col1 varchar2(10),
    col2 varchar2(10)
    
    
    
    select count(*) from TAB_A
    --------------------
    4587609
    
    select count(*) from TAB_A where id2=10 
    ------------------
    6000
    
    Here is my question
    
    
    can i create an index only for the cloumn id2 only for the value 10?
    Thank you
    Mike

    Hi, Mike,.

    You can have a function-based index.

    CREATE INDEX tab_a_id2_10 ON tab_a
    (   CASE
            WHEN  id2 IN (10)
            THEN  id2
        END
    );
    

    In Oracle 11.2, it might be cleaner to have a virtual column (indexed).

  • Is it possible to select only one column of a table for the redaction?

    Hi, converted a Word doc with a table in PDF format.  You will need to write a single column of the table.

    Is it possible to select only one column for the redaction?  When we select and drag downwards, it selects the other columns in the following lines.

    With the help of Acrobat X Pro.  Any help is appreciated.

    Hold down the CTRL key and drag a selection.

  • Identification of duplicates of 100% and duplicates only for key columns.

    Hello

    So far I have gathered these two tables:

    NAME | TASK | MISSION
    1 John 2
    1 John 2
    2 three Mike
    2 four Mike


    NAME | TASK | MISSION
    1 two Bob
    1 two Bob
    2 three Paul
    2 Paul four

    The result is
    NAME | TASK | MISSION
    1 John 2
    1 John 2
    2 three Mike
    2 four Mike
    1 two Bob
    1 two Bob
    2 three Paul
    2 Paul four

    What I need is I want to mark lines that are duplicates of 100% and who lines
    There's duplicates ONLY for the key of the fields NAME, TASK.

    How can I do this?

    metalray wrote:
    The only thing that that concerns me is the among of the typeing what I should do to get this
    made for my 85 + no key columns.

    You could always concatenate columns in a 75% and 100% of grouping in a subquery and run external applications, we have developed here against it.

  • How to set a Total sum only for the newly added lines

    Hi Experts,

    JDeveloper 12.1.3.0.0

    Hi I have a table and above, I have an Add button. During the click on Add I only show new lines using CreateWithParams.

    Existing or rescued lines that I went under certain conditions as false. So, how can I calculate the sum of the salary only for new lines and display it in the column Footer.

    Thank you

    Roy

    One approach would be to browse all lines and sum of lines in the getter for the variable 'total '.

    http://adfcodebits.blogspot.com/2010/04/bit-4-iterating-view-object-using.html

    Dario

  • How to make only two columns as editable in five online when the user clicks a line using adf 12.1.3.

    Hello

    I displays a table on the screen. This table is read only during the initial page load. I want to do only two columns as editable on five in a row when the user clicks a line using adf 12.1.3.

    Is it possible in the adf. If possible how to handle this. Please help on this.

    For example, drop table editable Full and then replace rest inputText (components entry in general) with af:outoutText, everything except those two.

    And use the clickToEdit feature...?

  • Currency symbol only for total.

    Hello

    My requirement is I want currency symbol $ only for total, all the lines in this column do not have the symbol.
    I need your help.

    Thank you.

    I see a way by defining a $image before the value.
    Using the Sigma icon-> select Format-> Image values are trying to add image $ and the value of "Placement of the Image" left

    Hope that this help pls mark as correct/good

  • ORA-12899: value too large for column

    Hi Experts,

    I get data of erp in the form of feed systems, in particular a column length in animal feed is only 3.

    In the column of the target table was also length is VARCHAR2 (3)

    but when I try to load even in db it showing errors such as:

    ORA-12899: value too large for column
    emp_name (population: 4, maximum: 3)

    I use the version of database:
    Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production

    but it is solved when the time to increase the length of the column target for varchar2 (5) of VARCHAR2 (3)... but I checked the length of this column in the feed is only 3...


    My question is why we need to increase the length of target column?


    Thank you
    Surya

    Oracle Database 11 g Express Edition uses the UTF-8 character set.

  • Add aliases for columns

    Select
    (select where sum (w.inv_val) rm_xos w w.exp_cat_id = '1') as "exports of money."
    , (select where sum (w.inv_val) rm_xos w w.exp_cat_id = '2') as 'export on the basis of the Bill of lading.
    , (select sum (w.inv_val) in rm_xos w where w.exp_cat_id = '3') as 'balance balances. "
    ,
    , (select where sum (w.inv_val) rm_xos w w.exp_cat_id = '4') as "exports on the basis of payment beats".
    of rm_xos w

    I need the sum of the first three columns, as the fourth column, can I add aliases for columns?

    Having to do a full table for each column scan is extremely inefficient (as making purchases by buying a single point a time :()
    scanning table (I hope) only once

    select sum(case when w.exp_cat_id = '1' then w.inv_val end) as "Cash Exports",
           sum(case when w.exp_cat_id = '2' then w.inv_val end) as "Export on Consignment basis",
           sum(case when w.exp_cat_id = '3' then w.inv_val end) as "Undrawn balances",
           sum(case when w.exp_cat_id = '4' then w.inv_val end) as "Exports on def. payment basis",
           sum(case when w.exp_cat_id in ('1','2','3','4') then w.inv_val end) as "Sum of the four"
      from rm_xos w
    

    Concerning

    Etbin

    Edited by: Etbin the 26.8.2011 14:35
    You may also rotate

    select exp_cat_id,sum(inv_val) the_sum
      from rm_xos
     where exp_cat_id in ('1','2','3','4')
     group by rollup(exp_cat_id)
    

    Edited by: Etbin the 26.8.2011 14:41
    Note on efficiency

  • Remove only specific columns

    my tab as emp a structure below.
    employee_id number primary key, emp_name varchar2 (20) not null, mgr_id number, dept_id
    job_id varchar2 (10), salary number 4
    This table contains some data in it.

    When I run under query the oracle gives me an error...
    my query is = remove employee_id, salary, job_id from emp where dept_id = 90

    that its gives me an error = ORA-00933: SQL not correctly completed command
    u please can there which gives such a mistake?
    Thank you

    Hello

    Please see this use and DELETE syntax in the manual of the SQL language:
    http://download.Oracle.com/docs/CD/B28359_01/server.111/b28286/statements_8005.htm#sthref7842
    REMOVE removes whole lines in a table.

    You probably want to update this table, leaving all the lines, but affecting some of the NULL columns on some lines, something like this:

    UPDATE     emp
    SET      employee_id     = NULL
    ,      salary          = NULL
    ,      job_id           = NULL
    WHERE     dept_id     = 90
    ;
    

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements), and the results you want from this data.
    In the case of an operation DML (for example, DELETE or UPDATE), the sample data should show what looks like the tables before the DML, and results will be the content of the or the tables changed after the DML.
    Explain how you get these results from these data.
    Always tell what version of Oracle you are using.

  • Cannot select only one column in a double-column PDF

    See the following pdf file example. I can't select a single column. Whenever I have select several lines, I will have two columns. I currently solve this problem by converting the PDF into an image file and load into Acrobat and OCR on it. But this isn't an ideal solution. I wonder if there is a better solution to fix the pdf file so that I can select only one column at a time.

    https://sites.Google.com/site/sharedacrobat/data/double_column.PDF?attredirects=0 & d = 1

    Use Acrobat Pro to tag a PDF file.

    Look at this PDF file:

    http://www.Adobe.com/content/dam/Adobe/en/DevNet/PDF/PDFs/PDF32000_2008.PDF

    to determine what the appropriate marking is, else "smile, be happy" can become remote.

    Look over article 14.

    Alternatives:

    --| Use Acrobat Pro to add tags to the Document. Does Acrobat to make a "best estimate" for marking. OK for a simple PDF content. not ok for other than simple.

    Use a copy of the PDF test to determine if it meets your needs.

    --| If the file creation supports establishing a logical hierarchy of command content (via the built-in tags, titles and styles) and has a proper Tag for output Tagged PDF management then the majority of the work tag can be done from the outset. Creating applications that are 'good things' - FrameMaker, InDesign, Open Office and MS Word.

    There will always be a need to do some post processing with Acrobat Pro.

    If you have InDesign; See:

    http://blogs.Adobe.com/accessibility/2009/07/indesign_accessibility_best_pr.html

    http://www.Adobe.com/accessibility/products/InDesign/

    http://TV.Adobe.com/watch/accessibility-Adobe/preparing-InDesign-files-for-accessibility

    You will notice that the emphasis on tutorials for 'PDF containing the tag' is mainly for 'Accessible PDF'. Accessible PDF is one of the facilities provided by the tag PDF.

    Another is the export of PDF contents in other applications while maintaining the format/layout in the export. A file PDF containing the tag with a well-trained tree not only supports accessibility, it also supports cut/copy - paste & export of content.

    Other tutorials "Accessible PDF" are available on Adobe TV and the Learning Center community user Acrobat.

    http://acrobatusers.com/learning_center

    Be well...

  • DBMS_STATS. GATHER_schema_STATS METHOD_OPT = > 'FOR COLUMNS SIZE AUTO '.

    Hi all

    What is the difference between METHOD_OPT = > 'For the COLUMNS SIZE AUTO' and METHOD_OPT = > 'for all COLUMNS SIZE AUTO' option to DBMS_STATS. GATHER_SCHEMA_STATS?

    user13071592 wrote:
    I'm collecting statistics by level of schema only.
    I know that this option is not correct according to the link you posted.
    but the option work fine in Oracle 9i. I have faced the problem with this when my database got Oracle 9i to Oracle 11 g.

    It just took me about five minutes to perform a little test on 9i to see what you get:

    execute dbms_stats.gather_schema_stats('XXX', method_opt=>'for columns size auto');
    

    The option out to not be valid, but it is accepted and seems to give you at the level of statistical tables only, no column, no index stats stats.
    When you include the option "ALL" in 11g to get the correct syntax, you probably found stats column with histograms (which can be expensive) and stats index (which can be expensive).

    If 11g allows you to use nethod_opt => "for the table", so this, combined with the cascade-online fake, can give you the same results you had for 9i - roughly the same speed. It is not a good option for a production system, however.

    Concerning
    Jonathan Lewis

Maybe you are looking for

  • need help with the lion kernel panic

    Hey all,. I have an iMac 2006 20 "2.16 GHz with 4 GB of RAM and a disc hard 250 GB 10.7.5 OS X Lion. The iMac has recently experienced a kernel panic, and I don't know why. I have not been running new programs or change my habits of use recently. It

  • My pc with UEFI windows8 was able to start at the WSC windows8

    I don't know if it's supposed to happen, but recently I wanted to install windows7 and I put my system in legacy mode and came a message saying that I wouldn't be able to start the operating system. To restart my system, Windows8 was able to boot to

  • Need help request!

    Hi allI am faced with a request to generate a model:The problem is the following:I have a test table increate table test(Identification number,varchar2 (20 char) value,date date);and the row values are as follows:value date: ID:1:value1:Date11:value2

  • Completed forms appear white until the click

    Hello! I have a problem of forms. All form fields are compiled, but they appear blank until I click on them. This behavior are the blank forms if I try to print. Here is a screenshot:

  • 1 extraction process may work for the 2 diagrams?

    HelloMy question is this:I ext1 extraction process, but I want this process to work for the 2 diagrams like HR and scott.I couldn't find the correct syntax for the 2 diagrams. He works for hr diagram but I could not add the correct settings for scott