Index not picked when bind parameter can be null?

Hi,
In my query i have a primary key say deptid and has an unique index defined.
when i do a query as
select * from dept where ((deptid = :pDeptId) or (:pDeptId is null))
index is not picked up and a full table scan happens.
Can one explain why?
Thanks
Manish

Solomon Yakobson wrote:
I purposely chose small table. Yes, optimizer calculated costs are such that FTS cost is same as combined cost of index fast scan + table access by rowid. And that is exactly what I am questioning. Set aside what you call "boundary" cases where rows are sparse enough (e.g. your example with lots of deleted rows) and similar scenarios (e.g. pctfree is very large, etc.) FTS is always less costly than index fast scan + table access by rowid by at least one IO. I understand, I am splitting hairs a bit since the difference is negligible, but still it is a sub-optimal plan.Solomon,
and yes, in those circumstances you describe the FTS will be chosen, so what is your point? Your test case represents such an "odd" scenario (sparse, large pctfree, etc., less rows than blocks, a clustering factor of the index less than the number of blocks of the table), so what do you want to prove using this test case? It doesn't represent the "normal" circumstances where the FTS is less costly.
In passing, the cost of the FTS and the combined operation are not the same in my default 10.2.0.4 database, the FTS is more expensive, as I've outlined previously.
The reason: It takes at least 1 multi-block I/O request to read the 5 blocks of the table. The optimizer assumes that the time it takes to perform a multi-block read request is 26ms when using default NOWORKLOAD system statistics with 8KB default block size. It assumes further it takes 12ms to perform a single-block read request, so the cost (expressed in single-block reads) of performing a single multi-block read request is 2.16. Since Oracle 9i, there is a hidden parameter "_table_scan_cost_plus_one" set to "true", it used to be "false" in 8i, making the cost 3.16, so we end up with a rounded cost of 3 for the FTS.
The cost of the combined index + table access is 2, one I/O for the index, plus one I/O for the table access. So from an optimizer perspective this plan is not sub-optimal, but the superior one, mainly due to the fact that one gets added to the table scan cost from 9i on, and you have the unusual clustering factor of 1.
As you can see, it takes a lot of "boundary" conditions that this happens, and it's all down to the fact that the table is so small, that is has only 4 rows in 5 blocks, and the clustering factor of the index is less than the number of blocks of the table, which is quite unusual. A "optimal" clustering factor usually corresponds to the number of blocks of the table, a "bad" clustering factor corresponds to the number of rows.
Therefore I suggested to "adjust" the clustering factor to a more usual value, but there is actually nothing usual about this test case since you have less rows than blocks.
So I guess you can say whatever you want about this being a "sub-optimal" plan, but I really don't see the point it makes, given the flawed test case. Run it with a more reasonable setup and the FTS will be used in those cases where it is reasonable according to the inputs the CBO gets.
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/

Similar Messages

  • Lion Clients 10.7.4 show network accounts are unavailable and server is not responding when binding to Snow Leopard server 10.6.8

    Hello,
    I am running Snow Leopard Server 10.6.8 and my clients are Lion 10.7.4.  While testing I had no issues binding 10.7.4 to our 10.6.8 server's OD.  I created a 10.7.4 image to push to all of our machines and in the beginning of last week I was able to push the image and get the machines to bind with OD and apply preferences on these machines through workgroup manager.  Towards the end of the week though this stopped working.  Now any time I bind a 10.7.4 client to OD it allows me to perform an authenticated bind and the machine shows up in workgroup manager but immediatley after binding the client the status jelly next to the OD server in the directory list is red and says "This server is not responding".  If I reboot the client I get a notification that "Network accounts are unavailable" at the login screen.  My preferences from workgroup manager are also not applying, which is my main concern because without workgroup manager my mac server is somewhat pointless as we use it for very little else. 
    I've since tried to bind a snow leopard machine (10.6.8) and this still is working with a green status jelly.  I've also built a lion machine from scratch, updated to the 10.7.4 combined update and am still getting the same issue where it shows the server is not responding when binding to OD.  I then applied the subsiquent OS update after the 10.7.4 combined update but the problem still persists.
    Is anyone else having this issue?  Any help would help me keep my sanity.
    Thanks,
    Dane

    Have you had any luck finding a solution to this?  The only thing I have found was to unbind and then bind without authentication.  Any help with progress on your end would be appreciated!
    Nick.

  • Auto feed for 4x6 photos moves to back but HP photo paper does not pick-up . What can I do to fix.

    Auto feed for 4x6 photos moves to back but HP photo paper does not pick-up .  What can I do to fix. Photosmart C6180, MS Vista
    Have tried one sheet, multiple sheets, new pack of photo paper etc.

    Hi there,
    This article should help as it covers cleaning your pickup rollers. Check out the video and give the steps outlined a shot and let us know if it helps.
    Best of Luck!
    You can say thanks by clicking the Kudos Star in my post. If my post resolves your problem, please mark it as Accepted Solution so others can benefit too.

  • How do I set up a mail group on mac mail?  All the advise on line seems to refer to 'address book' and I only have 'contacts'.  The guidance does not work when using 'contacts' - can anyone help me?

    How do I set up a mail group on mac mail?  All the advise on line seems to refer to 'address book' and I only have 'contacts'.  The guidance does not work when using 'contacts' - can anyone help me?

    Create a group and send mail
    http://www.dummies.com/how-to/content/how-to-create-a-basic-contact-group-in-mac -os-x-li.html
    http://www.macworld.com/article/1165582/how_to_email_groups_with_mail.html
    Best.

  • Error Indexing not allowed when marking indexing for document HR_DOC

    Hello all,
    We are able to solve the first problem. Now we have the following error
    "Error Indexing not allowed when marking indexing for document HR_DOC"
    Has anyone idea on how to solve it?
    Thanks a lot.
    Best regards,

    ....and thanks a lot for your feedback in resolving this issue!

  • Excise duty not picking when we enter basic price in contract

    Hi Friends,
    When we are creating contract, we have to manually enter basic price after entering basic price system is not picking Excise duties. But we are doing carry out new pricing that system is picking excise duty. So i need solution from all SD experts.
    I need two options one is when we are creating contract after entering basic price system should automatically pick Excise duty. Or System should prompt that i have to carry out new price. Please suggest how to do.
    Thanks in advance
    Sree

    Use same Excise Con Type based pricing procedure, Wat you might be using for your normal sales order.
    Or you can refer standard pricing procedure foor excise based pricing
    JINFAC     IN:Factory sale (pefer)
    JFACT     IN:Factory sale with formula
    Primarily, maintain Condition Record for Excise Duty Con Type with relevant access seq & tax code in VK11.
    On execution, check plant & S Loc. determination should take place automatically.
    Thanks & Regards
    JP

  • Process does not end when binding a object to registry

    I am writing a Unit Test case in which i need to create a datasource and bind it to RMI registry so that the methods i need to test can get a database connection . The problem is that after the test cases have finished running the process does not end and i have to shut it down manually . When i do not bind the datasource , the process ends put with errors because the methods do not get a connection. Even unbinding it after running the test cases does not help.
    Edited by: gurpreetbhalla on Jun 25, 2009 11:56 AM

    public void testIntraDayForClient() throws Exception
              ConstantConfig.JNDI_FACTORY = "com.sun.jndi.rmi.registry.RegistryContextFactory";
              Hashtable env = new Hashtable();
              env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.rmi.registry.RegistryContextFactory");
              env.put(Context.PROVIDER_URL, "rmi:");
    InitialContext ic = new InitialContext(env);
    // Construct DataSource
    SQLServerConnectionPoolDataSource ds = new SQLServerConnectionPoolDataSource();
    ds.setURL("jdbc:sqlserver://10.200.41.201:1433;databaseName=TradeportTC");
    ds.setUser("sa");
    ds.setPassword("superuser");
    DataSource d = ds;
         ic.unbind("TCDB_JNDI");
    ic.bind("TCDB_JNDI", ds);
              HttpServletRequest req = new MockHttpRequest();
              HttpServletResponse resp = EasyMock.createMock(HttpServletResponse.class);
              ActionContext context = EasyMock.createMock(ActionContext.class);
              HttpSession session = EasyMock.createMock(HttpSession.class);
              EasyMock.expect(session.getAttribute("ZephyrUserName")).andReturn("sclient90");
              EasyMock.expect(session.getAttribute("ZephyrDomainId")).andReturn("8a48a9cb1860e2a4011860e2c64d003a");
              EasyMock.expect(session.getAttribute("isTrader")).andReturn(false);
              EasyMock.expect(session.getAttribute("accountsDataDB")).andReturn(null);
              EasyMock.expect(context.getSession()).andReturn(session).times(12);
              session.setAttribute("vawTrades", null);
              session.setAttribute("noOfDays", null);
              session.setAttribute("accountNo", null);
              session.setAttribute("exchange", null);
              session.setAttribute("symbolName", null);
              session.setAttribute("trCode", null);
              session.setAttribute("status", null);
              session.setAttribute("accountsDataDB", null);
              EasyMock.replay(session);
              EasyMock.replay(context);
              MyOrdersAction action = new MyOrdersAction();
              action.execute(req, resp, context);
    This is the unit test case which does not exit , if i skip this binding ic.bind("TCDB_JNDI", ds);
    then it exits normally with a failure,

  • Index not picked up by the query

    I am doing complex joining with multiple tables ..
    table A has got 104M records other tables are having circa 100K records ...
    Now I have created index on table A on a field which is being used in filter condition ... but when I analysing the explain plan of the query - I can see table A has been fully accessed - index is not being used.
    Can anyone put some llight why it is happening ... Is it somthing to do with what I am selecting in the query ...

    You can search the forum for the same question and get other threads on this topic.
    The short answer is that the index isn't being used because the optimizer decides that doing the full table scan (FTS) is more efficient - it may or may not be right. There are lots of factors that could make the cost-based optimizer (CBO) not use an index, but the more common ones are
    * modifying a WHERE clause column value with ||, arithmetic, or a function (index supression)
    * You're going to read all or most of the rows in the table anyway, so the index would not help (at least, the CBO might think so)

  • Cell is not editable when doubleclickd but can edit when traversed by keybo

    I could able to edit the particular field in a table when traversed through keyboard but could not able to edit it when i doubleclick on it.
    JTable mScoresTbl = null;
    mScoresTblMdl = new AgingTableModel();  // my custom model
    mScoresTbl = new JTable(mScoresTblMdl);
    NumberEditField editField = new IntegerEditField(6); // NumberEditField have custom validation for numbers
    editField.setNegativeAllowed(false);
    editField.setMaxNumberOfIntegerDigits(3);
    editField.setAutoscrolls(false);
    TableCellEditor cellEditor = new NumberEditFieldCellEditor(editField);
    mScoresTbl.setDefaultEditor(Number.class, cellEditor);But if i'm not using setDefaultEditor i can able to edit the columns.
    Is there any other method to validate the column?

    Skotty wrote:
    Did you override isCellEditable in your editor? If so, what's it doing?That's the point of waiting for an SSCCE. Asking a series of questions is a lot less efficient than just asking for all of the information up front- and an SSCCE is the best way to obtain it. Plus it gives the OP a chance to figure it out for himself during the process of boiling the problem down to the bare essentials.

  • 2.1 update: Does not sound when checking email, can you please assist?

    Not sure if this was already posted, so I'm sorry in advance. But when I'm checking my emails, I don't get the tone/vibration for new incoming emails anymore after the 2.1 update from what I noticed. Is anyone else experiencing the same problem? or is this just an isolated issue that is happening?
    I also checked my options and sound is on.

    Yep.. You are not alone.. Check out this thread..
    http://discussions.apple.com/thread.jspa?threadID=1708956&tstart=0
    It's a new bug introduced in 2.1..

  • TS4002 I'm trying to create a new apple-id but when typing the email adress I want to use I'm told that the particular email adress is not allowed but when searching I can't find same being used. How do I find out where that particular email adress is use

    I'm trying to create a new apple-id but when typing the email adress I want to use I'm told that the particular email adress is not allowed When searching I can't find same being used anywhere. How do I find out where that particular email adress is used so I can delete it there and use it for my new apple-id?

    Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
    iOS: Wrong passcode results in red disabled screen                         
    If recovery mode does not work try DFU mode.                        
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings        
    For how to restore:
    iTunes: Restoring iOS software
    To restore from backup see:
    iOS: How to back up     
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload most iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store        
    Also
    If you have Find My iPhone enabled, you can use Remote Wipe to erase the contents of your device. If you have been using iCloud to back up, you may be able to restore the most recent backup to reset the passcode after the device has been erased.

  • I'm staying at my house in Peru, South America. From my PC laptop I can see my neighbor's wifi service network, but I also have my mini iPad and I can not figure out why I can't get any wifi connection from my area. Is there a setting I need to do?

    I'm staying at my house in Peru, South America. From my PC laptop I can see my neighbor's wifi service network, but I also have my mini iPad and I can not figure out why I can't get any wifi connection from my area. Is there a setting I need to do?

    Yes, I did try to go on my settings>wifi and was waiting for any wifi signals to pick up, but nothing shows up. But on my PC I get a whole list of networks to choose from. Regarding my neighbor, I already have her password that is why I was able to get it on my PC, the problem is that the mini Ipad is not picking any signal neither can it locate me when I go to maps.

  • Release Strategy is not picking up in the PO.

    Hi All
    I have defined a Release Strategy for the Purchase Order.
    The Characteristics are
    PO category
    Pur Org
    Total Net Order Value
    All the lights are green which i check the release strategy.
    But the Release Strategy is not picking when PO is created.
    Kindly let me know what is the mistake i have dont or i need to make any corrections.
    Thanks in advance
    Renukaprasad.

    Hi Renuka,
    im using ECC6, my PO rel strategy dont have PO catergory,
    but you can try this:
    Maintained PO characteristics:
    PO doc type
    PO Plant
    PO Pur Grp
    PO total Value
    Once your PO meet this, Rel Strategy triggres.
    When you define the Rel Strategy, there is rel indicator Approved and Block, configure based on your requirement.
    Hope this helps a little
    Regards,
    Maia

  • Zen Orginizer not picking up Zen Mi

    when i go to my orginizer i do not see my Zen Micro on the left. when I plug it into the USB i hear the sounds that it is recognized and i see that it is recognized when I go to my Device Manager, but the Zen Orginizer is not picking it up.

    You can do a couple things. One or the othershould help. Update your Windows Media Player to version0 http://www.filehippo.com/download_wi...edia_player/9/ to check for components of CMS5 Go to Start>All Programs>Creative System Information>Creative Products>Creative Software> Creative Media Source5 there you will find the installed components of the software. The one you are looking for is this one: If you don't have this component installed MediaSource5 won't recognize your device
    http://support.creative.com/Products/ProductDetails.aspx?catID=23&subCatID=24&prodID=47 9&prodName=Zen%20Micro%20SE&subCatName=ZEN&CatName =MP3+Players

  • AR Credit Memo's not picked by Auto Invoice

    Hi gurus,
    I am facing an issue in loading the CM's through Auto Invoice. when we submit the Auto Invoice Master Program, it is populating the Interface_line_id, but it's not populating request_id, so eventually the Auto Invoice Import program is not picking those records with request_id as null.
    Please advice me, how to process the CM's.
    Thanks
    Srinivas

    Hi Ivruksh,
    Thanks for the reply, the reference you gave was not actually related to the issue I had, let me put it this way,
    Our Auto Invoice Job is scheduled at midnight, it runs and process only few CM's, rest of them are left behind with out any error message in error tables. Al I can see in the ra_interface_lines_all table is interface_line_id is populated, which shows that the Auto Invoice program has picked all the records but it is processing only few, the rest are left out with out any error message.
    Interestingly, when I tried to run those stuck CM's Individual one by one its gets successfully processed.
    Is anyone faced with similar kind of issue, kindly let me know of any solutions you guys had.
    Thanks in advance.
    Regards
    Srinivas

Maybe you are looking for

  • Routing in Stock Transfer Order

    Hi, We are having SAP 4.7 & we have activated Transportation Routing process. Routing is copied in Sales order & Delivery. But the same is not copied in the stock transfer Order. We are doing following steps. We are using Stock Transfer order to tran

  • Day must be between 1 and last day of the month

    Hi I have a master detail form . Master Block contain emp_no,name,month etc. Detail block contain a date field(format mask 'dd'),a day field(the day on that day) and working hours detail of each day. when i enter the date in detail block it defaults

  • Messages In Mobile Simulator

    Hi, I am developng an application in Netweaer Mobile .I am Using NWDS 7.1 CE SP07. The application I am developing requires some validation. How could I use the message pool in the IDE and also how to trigger the same out of it. Regards, Muhammed Nis

  • Internet Explorer 8 have to reinstall Flash Player after each restart.

    Everytime I reboot the computer the latest flash player is no longer installed in Internet Explorer 8. I have tried everything under the sun and can not fix this problem. Any ideas?

  • Impdp taking long time for only few MBs data...

    Hi All, I have one query related to impdp. I have one expdp file and size is 47M. When I restore this dmp using impdp it will take more time. Also initially table_data loaded finsih very fast but then later on alter function/procedure/view taking a l