Index usage and nested views

We've got some performance problems when using a complex view that queries against a couple nested views.
We need to use views because we have two outer joins against the same table.
Here's a simplified version:
create or replace view_b as
select a1, b1, c1, d1
from table_c, table_d, view_a
where table_c.c1 = view_a.a1(+)
and table_c.c2= table_d.d1
create or replace view_a as
select a1
from table_a, table_b
where table_a.a1 = table_b.b1(+)
A query that may present problems with large amounts of data is:
select a1, b1
from view_b
where a1 = 1234;
Do indexes of nested views get utilized? Any suggestions?
Thanks

How selective is INSTRUMENT_ID? Is that a primary key? Or are there many rows in the INSTRUMENT table with an INSTRUMENT_ID of 1?
Are the statistics on your table and your index up to date? How, precisely, were statistics gathered?
What version of Oracle are you using? If you are using something earlier than 11.1, it's entirely possible that you have a bind variable peeking problem.
Realistically, you would want Oracle to use two different query plans for this statement depending on the value of the bind variable. If you pass in a NULL, you'd want Oracle to do a table scan. If you pass in a value, you'd want Oracle to do an index scan. Prior to 11.1, when this statement is first parsed, Oracle looks at the bind variable you passed in and picks the best plan for that bind variable value. When you subsequently execute this statement with other bind variable values, that first query plan is used. Thus, if the first time this code was executed you passed in a NULL, it would have made sense for Oracle to choose the table scan and all subsequent executions (until the query was aged out of the shared pool) would continue to use that query plan.
Oracle 11.1 introduced the ability to have multiple query plans for the same query depending on the bind variable values that were passed in which may well alleviate the problem you're seeing.
Justin

Similar Messages

  • Index Usage and 'OR' Clause

    I am executing following SQL but index is not getting used.
    SELECT instement_id
    FROM instrument
    WHERE instrument_id = 100
    OR 1=1
    I have an index on instrument.instrument_id but it is not getting used the oprimizer is going for full table scam...
    when i remove 1=1 then index on instrument_id is used...
    but i am not able to understand the logic that if i add 1=1 in 'OR' Clause then why index is not getting used.
    This is urgent..let me know asap...
    Thanks
    Rohit

    How selective is INSTRUMENT_ID? Is that a primary key? Or are there many rows in the INSTRUMENT table with an INSTRUMENT_ID of 1?
    Are the statistics on your table and your index up to date? How, precisely, were statistics gathered?
    What version of Oracle are you using? If you are using something earlier than 11.1, it's entirely possible that you have a bind variable peeking problem.
    Realistically, you would want Oracle to use two different query plans for this statement depending on the value of the bind variable. If you pass in a NULL, you'd want Oracle to do a table scan. If you pass in a value, you'd want Oracle to do an index scan. Prior to 11.1, when this statement is first parsed, Oracle looks at the bind variable you passed in and picks the best plan for that bind variable value. When you subsequently execute this statement with other bind variable values, that first query plan is used. Thus, if the first time this code was executed you passed in a NULL, it would have made sense for Oracle to choose the table scan and all subsequent executions (until the query was aged out of the shared pool) would continue to use that query plan.
    Oracle 11.1 introduced the ability to have multiple query plans for the same query depending on the bind variable values that were passed in which may well alleviate the problem you're seeing.
    Justin

  • [svn:cairngorm3:] 17872: Popup: Exposed set accessor of open for view state usage and fixed bug when closing from model within popup .

    Revision: 17872
    Revision: 17872
    Author:   [email protected]
    Date:     2010-09-27 08:04:40 -0700 (Mon, 27 Sep 2010)
    Log Message:
    Popup: Exposed set accessor of open for view state usage and fixed bug when closing from model within popup. http://www.spicefactory.org/forum/viewtopic.php?p=3932. Added new sample to show model and view state interactions.
    Modified Paths:
        cairngorm3/trunk/libraries/Popup/src/com/adobe/cairngorm/popup/PopUpBase.as
        cairngorm3/trunk/libraries/Popup/src/com/adobe/cairngorm/popup/PopUpFactory.as
        cairngorm3/trunk/libraries/Popup/src/com/adobe/cairngorm/popup/PopUpWrapper.as
        cairngorm3/trunk/libraries/PopupTest/.actionScriptProperties
        cairngorm3/trunk/libraries/PopupTest/src/samples/MyPopup.mxml
        cairngorm3/trunk/libraries/PopupTest/src/samples/PopUpPM.as
    Added Paths:
        cairngorm3/trunk/libraries/PopupTest/src/PopUpModelExample.mxml
        cairngorm3/trunk/libraries/PopupTest/src/samples/MyPopupWithModel.mxml

    Lots to be excited about. BUT...Just updated to 8.1 on one of my computers to test it out...
    Sadly, the following issue is NOT fixed for me. Is it with new projects only?  I haven't started a new project on 8.1 I've only opened an old project but the issue that I'm referring to which involves also a delay/freeze of anywhere from a few seconds to a MINUTE while the render bar goes from yellow to red and then back to yellow is still there. Boo.
    On the list above...
    Switching between sequences can turn the render bar red.
    This issue is incredibly easy to replicate. I really do hope it gets fixed. Here are the steps:
    1) Create two sequences with multiple short clips (the more clips the better)
    2) Make sure GPU acceleration is enabled.
    3) Add warp stabilizer to the clips in both sequences. Again, the more clips the longer the delay/freeze will be as the render bar goes from YELLOW to RED and then eventually back to YELLOW again.
    4) Hit SAVE.
    5) Now, toggle between sequences. You'll hit a short delay with a few clips stabilized and a LONG delay with lots stabilized. In my case this delay is around a full minute. The render bar will go from YELLOW to RED and then back to yellow...eventually.
    6) Toggle back to the original sequence and the delay occurs again.
    7) Once you've toggled between sequences and have gone through this delay, that's it, there is no longer a delay...UNTIL...(and here's the big kicker)...until the project is SAVED again. After that the issue returns when you toggle between sequences. Both saving manually and AUTOSAVING cause this issue. No way around it except not editing with GPU acceleration.
    Not sure what the issue is...caching issue when saving maybe? Either way, it stinks and it's still there in 8.1. Big bummer.
    Again, lots to be excited about with this release but I really was hopefully this specific issue was resolved.
    Sigh.

  • UNUSED EXISTING INDEXES / Index usage

    We are using CRM 2007, Netweaver 7.0 with DB2 UDB v9.1 fixpack4 on AIX.
    Is there a way to find out  UNUSED EXISTING INDEXES for tables ? We have close 12 indexes on the crmd_order_index table and want to find out if some of them can safely deleted. Is there any way to monitor index usage in SAP ? Is there any toold to aid this ?
    Pls advise.
    thank you
    regards
    Laxmi

    Laxmi,
    I am not aware of any such tools with DB2 9.1.  However, "last_used" columns are being added to various catalog tables in DB2 9.7.  Below is an excerpt from a slide presented in the  TLU2008A "DB2 LUW V9.7 Cobra u2013 Storage is Charmed" session.
    The last reference time of an object will now be maintained in the LASTUSED column of
    the corresponding catalog table for the object
    u2013 SYSCAT.INDEXES.LASTUSED (prior to V9.7 db2pd u2013tcbstats indexes)
    u2013 SYSCAT.TABLES.LASTUSED
    u2013 SYSCAT.DATAPARTITIONS.LASTUSED
    u2013 SYSCAT.PACKAGE.LASTUSED
    The LASTUSED column is of type DATE (default value is 1/1/0001)
    Use Cases:
    u2013 Detach table partitions that are no longer actively used (esp. when not partitioned by time)
    u2013 Determine inactive or infrequently used indexes
    u2013 Easily identify tables which are no longer in use
    u2013 Get rid of unused packages
    The presenter said the code will begin populating these columns in an upcoming fixpack.
    Regards,
    Rick

  • 'IS NOT NULL' & Index Usage

    Hi,
    there are many queries my one of my packages, which has the SQL as follows:
    Update table XYZ
    Set Column A = NULL
    Where Colum B IS NOT NULL;
    Column B has NUMBER datatype.
    Due to 'IS NOT NULL' the index (existing for Column B' is not being used in the above query, leading to Full table scan. Is there any ways of forcing teh index to be picked/used by the query?
    Thanks,
    Rosalin

    thansk again for response. Checked the % of the data
    fetched by this query and it ranges from 20% to 50
    %(varies due to teh fact the table data content could
    have different set of data depending on the days
    transactions done). So for sure index usage would
    help.
    Additionally this sql(used in multiple places) come
    up in the v$longsops output.
    so definitely needs tuning.
    Any suggestions?That's not really true though if you understand the mechanisms employed for a full table scan vs an index scan / table lookup (by rowid since the table must also be visited).
    Here's something good for you to read
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:4433887271030
    A full tablescan reads the table using large sequential reads -- many blocks at a time.
    Sequential reads are the fastest type of IO you can do on a disk in general.
    An index read will do single block, random IO's. These are generally the slowest you can
    do.
    I would suggest to you that if you have statistics on the table/indexes that are representative of the data, the Optimizer will be smarter than you (most cases, not all).
    Message was edited by:
    Tubby

  • Performance with Nested Views

    Hello everyone, we are having a performance problem with oracle optimizing nested views. Some with outer joins. One of the guys just sent me the following statement and I'm wondering if anyone can tell me if it sounds correct. The query is about 300 lines long so I won't post it here, but hopefully someone can still help with sheding some light on the statement below.
    When Oracle executes a view it optimizes the query plan only for the columns of the view which are used and eliminates unnecessary joins, function calls, etc.. In this case the join is a LEFT OUTER i.e. optional and since the columns are not used I would hope Oracle would eliminate this from the plan but… it didn’t.
    Thanks for any help,
    Michael Cunningham

    Depending on the version of Oracle (this was introduced in 10.2), it is possible that Oracle can eliminate a join. The Oracle Optimizer group has a nice blog post that discusses the requirements for join elimination to happen. Basically, Oracle has to be sure that the additional columns aren't being used but also that the join does not change the number of rows that might be returned.
    Justin

  • Design view and browser view in DW are different than when I view from local folder

    I'm brand new to Dreamweaver CS5.5 and here is my problem:
    I've made an html page in dreamweaver with a banner, with an additional graphic and some text on top of the banner.  It displays just fine in every browser when I view from the local folder, but when I open DW and view, it displays incorrectly in all three design, live and browser views within DW.  If I make changes to the css file until it views correctly in design view, it no longer displays correctly from the local folder and it still doesn't view correctly in live or browser view within DW.  If what I'm doing isnt going to display accurately in any of the views provided by Dreamweaver as compared to the live server, whats the point in having this software?  I could just keep building webpages in notepad and uploading with CoreFTP.
    Any suggestions?  Is it some setting that I dont know about that I need to change within DW?   Please help.

    align="center" is deprecated (obsolete) code in XHTML & HTML5 doc types.  Instead of styling markup with HTML, you should be using CSS. 
    CSS
    .center {text-align:center}
    HTML
    <p class="center">some centered text here</p>
    With respect to break tags, in XHTML doc types the correct syntax is <br /> not <br>.  However your usage of line breaks is inconsistent with good symantic markup.  Use headings <h1> <h2> <h3> <h4> for important keywords.  Use <p> for descriptive paragraphs.  Use <ul> <li> or <ol> <li> for lists.  Line breaks should be used minimally if ever.
    XHTML doc types require all tags to be lowercase.  Uppercase tags will throw errors.
    Your design is too rigid.  When text size is increased in browsers, your content is unreadable.  See screenshot.
    SOLUTIONS:
    1) DO NOT USE POSITION ABSOLUTE.  You don't need it.  Absolute positioning removes content from the normal document flow resulting in a jumbled mess.  Use default CSS positioning (none) with margins, padding & floats to align elements.
    2) Remove HEIGHT values from all CSS containers.  Height limits a container's capacity to hold more content when needed.  Container height should always be determined by the amount of content it holds; not explicit values.  If required to reveal a background image, for example, use CSS min-height instead of height.
    CSS Box Model
    http://www.w3schools.com/css/css_boxmodel.asp
    CSS Floats
    http://www.w3schools.com/cssref/pr_class_float.asp
    CSS min-height
    http://www.w3schools.com/cssref/pr_dim_min-height.asp
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb
    http://alt-web.blogspot.com/

  • How can I quickly view pdf files like I can do with Windows Picture and Fax viewer for jpg files?

    How can I quickly view pdf files like I can do with Windows Picture and Fax viewer for jpg files? I need to look at several thousand PDF files. It takes too long to open each one individually. The only thing I could think of is combining them into large groups and then using the Navigation index. But I like the way windows Picture and Fax Viewer does it because you can keep the files separate. Combining PDFs causes loss of individual file names. That would be a problem since I do need to have the individual file names.

    Windows Picture and Fax Viewer is a DLL and is started via a rundll32.exe call and can't be set as an application to handle images in Firefox 3 and later versions.
    Try to set Windows Picture and Fax Viewer as the default viewer in Windows, then it should be listed automatically in the Mozilla Firefox Browse dialog.
    *http://www.winhelponline.com/articles/115/1/Windows-Picture-and-Fax-Viewer-as-the-default-viewer-in-Mozilla-Firefox.html
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''

  • How to add an index to a materialized view in Data Modeler 3.3

    Hello everyone,
    I'm looking for a how-to to add an index to a materialized view in Data Modeler 3.3.0.747, as I coudn't find a way to do it so far.
    I looked here:
    Relational Model
    Physical Model
    Oracle 11g
    Materialized Views
    "my_mv_name"
    "INDEXES" IS NOT HERE IN THE TREE
    "Tables" does not include it either
    Thank you & Best regards,
    Blama

    Hi David,
    thanks a lot. I did so and it worked, but I found a minor bug while doing so:
    I marked the table as "Implement as Materialized View" and went to File->Export->DDL (for Oracle 11g).
    The generated code (I checked all options in "Drop Selection") includes a row:
    DROP MATERIALIZED VIEW mv_mymatview CASCADE CONSTRAINTS ;
    which produces a syntax error.
    Best regards,
    Blama

  • SQL INDEX USAGE

    hi,
    I have a procedure which took 15-20 minutes in the past to execute.Suddently it is taking 2 hours.When i examined i came to know that the sql statement is not using one of the index.I dropped the index and created it.The explain plan is generated but still the index is not being used.I forced the index usage by using the index hint
    SELECT /*+ INDEX(test_his test_hist_idx )*/ column 1.....
    But still it does not use the index.Please suggest me some advice on this?
    Thanks

    user589320 wrote:
    I have a procedure which took 15-20 minutes in the past to execute.Suddently it is taking 2 hours.When i examined i came to know that the sql statement is not using one of the index.I dropped the index and created it.The explain plan is generated but still the index is not being used.I forced the index usage by using the index hint
    SELECT /*+ INDEX(test_his test_hist_idx )*/ column 1.....
    I think you're going to have to post the entire text of your query if you want an answer, or people will simply be trying to guess what you've done wrong.
    Do you also have the full execution plan from before and after the change in performance ?
    If you do post the text, and plans, please use the 'code' tags to make the text readable.
    p.s. My shot in the dark guess, based on the text you've supplied, is that you've used the table name in the hint, rather than the table alias.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    "The temptation to form premature theories upon insufficient data is the bane of our profession."
    Sherlock Holmes (Sir Arthur Conan Doyle) in "The Valley of Fear".
    To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}{noformat} (lowercase, curly brackets, no spaces) so that the text appears in fixed format.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to view image in sagittal, coronal and axial view in labview

    Hi guys
    Can anyboday help in visualization of images in sagittal, coronal and axial view . For example I have slices of image I want to look into all three plane, how to write code for this.
    I will Appreciate your help
    Thanks 
    Solved!
    Go to Solution.

    Thank you for your reply guys 
    Here I am attaching three axial slices please let me know how we can change index and visualize in sagittal and coronal plane.
    I really apprecite your help
    Attachments:
    slie1.jpg ‏31 KB
    slice2.jpg ‏36 KB
    slice3.jpg ‏44 KB

  • Package and class viewer

    Hello,
    Is there an equivalent of a menu item or short-cut key to bring up package and class viewer? A similar feature exists in Eclipse which builds the indexes and Ctrl-Shift-T will bring up all the classes in your workspace / project. I have seen something similar in Jdeveloper while running in debug mode, if it cannot find a file that is need for trace options, it throws up a window that says "Package and Class Viewer". It would be useful to access that during development as well.
    Thanks
    Farooq.

    Thanks for the repose. Ctrl+ , along with Ctrl= is doing the same thing. Also discovered Ctrl- will bring up java classes. Only thing remains is the remaining files in the project e.g XML or JSP files
    Thanks for you, got me in the right direction.

  • AVAudioRecorder data usage and sound quality

    Witch is the best setting to the right mix of file size(data usage) and sound quality(ability to hear the conversation) when we work with AVAudioRecorder.
    Thanks
    Willy

    AntonBecker wrote:
    Alternatively, I can avoid the overage fees by agreeing to change my plan -- increase my monthly allowance -- but I have to pay the difference for all of the months that have already gone by all the way back to the beginning of my contract.  In other words, I have to pay for additional GBs for months that are in the past and for which I have no possible way to actually use that data allowance. This is NOT TRUE. You can have the change backdated to the BEGINNING of your CURRENT billing cycle but it WILL NOT go further back than that.
    I must say, that as a business model for raking in un-earned revenue, it's pretty impressive.  As a customer, though, I'm not terribly impressed.
    Does anyone else feel that these practices are just a wee bit unfair, to put it mildly?
    I would think that the following would be fair business practices:
    (1) If I don't use some GB data allowance, for which I've already paid, then that allowance should roll into the next month OR; Verizon doesn't have roll over minutes and they most likely will not have roll over data.
    (2) I should get a refund for data allowance that I don't use. Should you ALSO get a refund for unused minutes while you are at it? I don't watch all of the channels for which my cable company charges me. I would prefer a refund for THOSE before I get a refund for minutes/data from Verizon. I would make a considerably larger refund with that.
    (3) Alternatively, since Verizon believes it is OK to charge extremely inflated overage fees, then I feel it's only fair that they refund to me, at that inflated rate, for GBs that I don't use in any given month.
    How do the rest of you feel? I feel you should most likely look for a provider which better fits your view on how they should price their service. Good luck.
    Sincerely frustrated,
    Anton

  • Differences between view and materialized view

    Hello,
    Please tell me the Differences between view and materialized view in oracle 9i.
    Thanks and regards
    Madhuri

    How can I create index in a view?
    Please read reply of Justin Sir.
    Regards
    Girish Sharma

  • Diff bt Help view and Maintanence view

    hi gem's
    i need the diff bt Help view and Maintanence view with example...............

    Hi
    The followings are different types of views:
    - Database View (SE11)
    Database views are implement an inner join, that is, only records of the primary table (selected via the join operation) for which the corresponding records of the secondary tables also exist are fetched. Inconsistencies between primary and secondary table could, therefore, lead to a reduced selection set.
    In database views, the join conditions can be formulated using equality relationships between any base fields. In the other types of view, they must be taken from existing foreign keys. That is, tables can only be collected in a maintenance or help view if they are linked to one another via foreign keys.
    - Help View ( SE54)
    Help views are used to output additional information when the online help system is called.
    When the F4 button is pressed for a screen field, a check is first made on whether a matchcode is defined for this field. If this is not the case, the help view is displayed in which the check table of the field is the primary table. Thus, for each table no more than one help view can be created, that is, a table can only be primary table in at most one help view.
    Go thru this link plzz
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ecf9446011d189700000e8322d00/frameset.htm
    Difference between "Help View" and "Search Help"
    - Projection View
    Projection views are used to suppress or mask certain fields in a table (projection), thus minimizing the number of interfaces. This means that only the data that is actually required is exchanged when the database is accessed.
    A projection view can draw upon only one table. Selection conditions cannot be specified for projection views.
    - Maintenance View ( SE54 )
    Maintenance views enable a business-oriented approach to looking at data, while at the same time, making it possible to maintain the data involved. Data from several tables can be summarized in a maintenance view and maintained collectively via this view. That is, the data is entered via the view and then distributed to the underlying tables by the system.
    Please have a look at below link. It will help you.
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ed06446011d189700000e8322d00/frameset.htm
    for more detailed info look on:
    http://www.sap-img.com/abap/what-is-the-different-types-and-usage-of-views.htm
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/abap+dictionary&
    1.Go to se11
    2. select view radiobutton and give a name
    3. Create
    4. select type of view you want to create. Such as database view.
    5. give short description
    6. give a table name such as mara
    7. press the pushbutton relationship. here you will find all the tables which are allowed to create view with mara.
    8. select one or mane tables.
    8 copy
    9.save , check and activate.
    Regards
    Anji

Maybe you are looking for

  • Diffeence b/w thin and thick driver

    diffeence b/w thin and thick driver

  • Formatting a new drive?

    Hi, this may be a really basic question, but i just bought a new external hard drive and I need to format it do that it is in a MAC format, currently in FAT32 - how do i do this? thanks a bunch!

  • Creation of standby logical controlfile

    can anybody let me know how to create standby logical controlfile.... i know how to create physical standby control file.... when i created a logical standby controlfile and after mounting the logical standby database, i got an erorr database name is

  • Mod_jserv.log

    Does anyone know whether the mod_jserv.log is used on a UNIX platform? I have an installation of 9ias on both NT and AIX and the mod_jserv.log file is there on NT but is not there on AIX. Thanks

  • IPhoto is deleting (some) EXIF-Tags when editing

    Hi, i have the following problem with iPhoto 6.0.4: When a picture is edited with iPhoto some of the stored EXIF informations are deleted. Sadly this is already the case when iPhoto rotates an image while importing it from my D50. A little example: T