10g doing VIEW type join even when no view in SQL - and performing poorly

Using 10.2.0.2.0
Every once in a while I see CBO deciding to use VIEW type join even when there is no view in the SQL and whenever it does that the performance just sucks.
Example –
SQL-
SELECT a.emplid, a.empl_rcd, TO_CHAR (((a.dur) + (:"SYS_B_00")), :"SYS_B_01"),
a.seqnum
FROM ps_wrk_adhoc_tao5 a, ps_tl_prof_wrk5 b, ps_tl_empl_data c
WHERE a.dur =
(SELECT MAX (a1.dur)
FROM ps_wrk_adhoc_tao5 a1
WHERE a1.process_instance = :"SYS_B_02"
AND a1.emplid = a.emplid
AND a1.empl_rcd = a.empl_rcd)
AND a.dur < TO_DATE (:"SYS_B_03", :"SYS_B_04")
AND NOT EXISTS (
SELECT :"SYS_B_05"
FROM ps_tl_ta_exceptn5 q
WHERE q.process_instance = :"SYS_B_06"
AND q.exception_id = :"SYS_B_07"
AND q.emplid = a.emplid
AND q.empl_rcd = a.empl_rcd
AND q.dur = a.dur)
AND :"SYS_B_08" = :"SYS_B_09"
AND c.emplid = a.emplid
AND b.emplid = a.emplid
AND c.empl_rcd = a.empl_rcd
AND b.empl_rcd = a.empl_rcd
AND c.effdt =
(SELECT MAX (c1.effdt)
FROM ps_tl_empl_data c1
WHERE c1.emplid = c.emplid
AND c1.empl_rcd = c.empl_rcd
AND c1.effdt <= ((a.dur) + (:"SYS_B_10")))
AND b.effdt =
(SELECT MAX (b1.effdt)
FROM ps_tl_prof_wrk5 b1
WHERE b1.process_instance = :"SYS_B_11"
AND b1.emplid = b.emplid
AND b1.empl_rcd = b.empl_rcd
AND b1.effdt <= ((a.dur) + (:"SYS_B_12")))
AND c.time_rptg_status = :"SYS_B_13"
AND b.empl_status IN (:"SYS_B_14", :"SYS_B_15", :"SYS_B_16", :"SYS_B_17")
AND a.process_instance = :"SYS_B_18"
AND b.process_instance = :"SYS_B_19"
Plan –
Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
SELECT STATEMENT Optimizer Mode=CHOOSE 1 18
NESTED LOOPS ANTI 1 153 13
NESTED LOOPS 1 125 12
NESTED LOOPS 1 103 10
HASH JOIN 1 76 9
INDEX RANGE SCAN SYSADM.PS0WRK_ADHOC_TAO5 7 245 2
SORT AGGREGATE 1 21
TABLE ACCESS BY INDEX ROWID SYSADM.PS_WRK_ADHOC_TAO5 6 126 3
INDEX RANGE SCAN SYSADM.PS_WRK_ADHOC_TAO5 6 2
VIEW SYS.VW_SQ_1 524 20 K 6
HASH GROUP BY 524 40 K 6
FILTER
MERGE JOIN 1 K 124 K 5
SORT JOIN 151 5 K 2
INDEX RANGE SCAN SYSADM.PS_TL_PROF_WRK5 151 5 K 1
SORT JOIN 214 8 K 3
INDEX RANGE SCAN SYSADM.PS0WRK_ADHOC_TAO5 214 8 K 2
TABLE ACCESS BY INDEX ROWID SYSADM.PS_TL_PROF_WRK5 1 27 1
INDEX UNIQUE SCAN SYSADM.PS_TL_PROF_WRK5 1 0
TABLE ACCESS BY INDEX ROWID SYSADM.PS_TL_EMPL_DATA 1 22 2
INDEX RANGE SCAN SYSADM.PS_TL_EMPL_DATA 1 1
SORT AGGREGATE 1 20
FIRST ROW 1 20 2
INDEX RANGE SCAN (MIN/MAX) SYSADM.PS_TL_EMPL_DATA 1 20 2
INDEX RANGE SCAN SYSADM.PS_TL_TA_EXCEPTN5 1 28 1
If I use a rule hint here I get this plan. I get the plan given below on another database even without the rule hint –
Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
SELECT STATEMENT Optimizer Mode=HINT: RULE
FILTER
FILTER
TABLE ACCESS BY INDEX ROWID SYSADM.PS_TL_EMPL_DATA
NESTED LOOPS
NESTED LOOPS
TABLE ACCESS BY INDEX ROWID SYSADM.PS_TL_PROF_WRK5
INDEX RANGE SCAN SYSADM.PS_TL_PROF_WRK5
TABLE ACCESS BY INDEX ROWID SYSADM.PS_WRK_ADHOC_TAO5
INDEX RANGE SCAN SYSADM.PS_WRK_ADHOC_TAO5
INDEX RANGE SCAN SYSADM.PS_TL_EMPL_DATA
SORT AGGREGATE
TABLE ACCESS BY INDEX ROWID SYSADM.PS_WRK_ADHOC_TAO5
INDEX RANGE SCAN SYSADM.PS_WRK_ADHOC_TAO5
INDEX RANGE SCAN SYSADM.PS_TL_TA_EXCEPTN5
SORT AGGREGATE
INDEX RANGE SCAN SYSADM.PS_TL_EMPL_DATA
SORT AGGREGATE
INDEX RANGE SCAN SYSADM.PS_TL_PROF_WRK5
The whole schema was analyzed using dbms.stats only yesterday. My question is why is Oracle doing VIEW, and how can I stop it from doing that. Hint is not an option.

I understand that SQL Developer takes it's NLS settings from Preferences - Database - NLS Parameters. What I was not aware of is that when SQL Developer is run for the first time the NLS Parameters seem to be populated from the settings on the OS of the PC it is running on. To test that this was the case I did the following
I work on a Windows XP system with Regional Options - Standards and Formats and Regional Options - Location set with English (United Kingdom) and United Kingdom respectively.
I unzipped two clean SQL Developer instances (both Version 1.2.1). The first instance I first ran under my current PC set up without importing settings from a previous installation. The Preferences - Database - NLS Parameters - Language and Preferences - Database - NLS Parameters - Territory had been populated with English and United Kingdom.
I then changed the Regional Options on the OS to English (United States) and United States and ran the second instance of SQL Developer for the first time, again without importing settings. In this instance of SQL Developer the NLS Parameters were populated with American and America.
When the first instance of SQL Developer was the checked under these OS settings the NLS Parameters were still English and United Kingdom.
I was not aware this was the case and, if my test is correct, it seems to contradict the SQL Developer user guide http://download.oracle.com/docs/cd/E10405_01/doc/appdev.120/e10406/intro.htm#CHDBHCAG
James
Message was edited by: Jampat to include SQL Developer version number.

Similar Messages

  • Optimizer choosing hash joins even when slower

    We have several queries where joins are being evaluated by full scans / hash joins even when forcing index use results in an execution time about a quarter the duration of the hash join plan. It still happens if I run DMS_STATS.GATHER_TABLE_STATS with FOR ALL COLUMNS.
    Is there a stats gathering option which is more likely to result in an indexd join without having to get developers to put optimizer hints in their queries?
    11g on SuSE 10.
    Many thanks.

    user10400178 wrote:
    That would require me to post a large amount of schema information as well to be of any added value.
    Surely there are some general recommendations one could make as to how to allow the optimizer to realise that joining through an index is going to be quicker than doing a full scan and hash join to a table.If you don't want to post the plans, then as a first step you basically need to verify yourself if the cardinality estimates returned by the execution plan correspond roughly to the actual cardinalities.
    E.g. in your execution plan there are steps like "FULL TABLE SCAN" and these operations likely have a corresponding "FILTER" predicate in the "Predicate Information" section below the plan.
    As first step you should run simple count queries ("select count(*) from ... where <FILTER/ACCESS predicates>") on the tables involved using the "FILTER" and "ACCESS" predicates mentioned to compare if the returned number of rows is in the same ballpark than the estimates mentioned in the plan.
    If these estimates are already way off then you know that for some reason the optimizer makes wrong assumptions and that's probably the reason why the suboptimal access pattern is preferred.
    One potential reason could be correlated column values, but since you're already on 11g you could make use of extended column statistics. See here for more details:
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28274/stats.htm#BEIEEIJA
    Another reason might simply that you're choosing a too low "estimate" sample size for the statistics collection. In 11g you should always use the DBMS_STATS.AUTO_SAMPLE_SIZE for the "estimate_percent" parameter of the DBMS_STATS.GATHER__STATS procedures. It should generate accurate statistics without the need to analyze all of the data. See here in Greg Rahn's blog for an example:
    http://structureddata.org/2007/09/17/oracle-11g-enhancements-to-dbms_stats/
    Regarding the histograms: Oracle 11g by default generates histograms if it deems them to be beneficial. It is controlled by the parameter "METHOD_OPT" which has the default value of "FOR ALL COLUMNS SIZE AUTO". The "SIZE" keyword determines the generation of histograms. You could use "SIZE 1" to prevent histogram generation, "SIZE <n>" to control the number of buckets to use for the histogram or "SIZE AUTO" to let Oracle decide itself when and how to generate histograms.
    Regarding the stored outlines: You could have so called "stored outlines" that force the optimizer to stick to a certain plan. That features was introduced a long time ago and is sometimes also referred to as "plan stability", its main purpose was an attempt to smooth the transition from the rule based optimizer (RBO) to the cost based optimizer (CBO) introduced in Oracle 7 (although you can use it for other purposes, too, of course). Oracle 11g offers now the new "SQL plan management" feature that is supposed to supersede the "plan stability" feature. For more information, look here:
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28274/outlines.htm#PFGRF707
    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/
    Edited by: Randolf Geist on Oct 16, 2008 4:20 PM
    Sample size note added
    Edited by: Randolf Geist on Oct 16, 2008 6:54 PM
    Outline info added

  • Sometimes I can't get out of Day view in iCal.  There is no where on the screen to select month view, even when I close it out and go back into iCal.

    Sometimes I am locked in "day" view in iCal.  There is no where on the screen to choose "month" view, even when I close it out and open again.  Tapping anywhere on the screen or scrolling doesn't help.

    Give this a try:
    1 - delete the iPhoto preference file, com.apple.iPhoto.plist, that resides in your
         User/Home/Library/ Preferences folder.
    2 - delete the contents the following folder: User/Library/Containers/com.apple.iPhoto
    3 - reboot, launch iPhoto and try full screen again.
    NOTE: For Mavericks and Yosemite,  go to your Home folder and use the View ➙ Show View Options menu to bring the this window:
    where you can check the Show Library Folder checkbox.

  • HT4437 hi even when i connect my macbook and apple tv to the same wifi network i cant put on the air play mirroring option.my airplay mirroring option does not detect any device.what can i do for this?

    hi even when i connect my macbook and apple tv to the same wifi network i cant put on the air play mirroring option.my airplay mirroring option does not detect any device.what can i do for this?

    See
    http://support.apple.com/kb/TS4215

  • JPGS are set to open in Photoshop Elements, but they open in Windows Photo Viewer instead, even when I specifically select Photoshop (and it's the default app)

    JPGS are set to open in Photoshop Elements, but they open in Windows Photo Viewer instead, even when I specifically select Photoshop (and it's the default app)

    Hi,
    It seems this is a Microsoft related. You are referring on how to set JPG Image in Photoshop Elements by default. You may try visiting Microsoft's Support page http://support.microsoft.com/ for you to get the correct information/help you need.
    Thank you.

  • I told my wireless network to forget two airport expresses so that I could rename them.  Now the network does not see them even when plugged in about 10 feet away from the airport extreme base station.  Does "forget" mean forever?  How to reset?

    I told my wireless network to forget two airport expresses 1 1st gen, 1 2nd gen so that I could rename them.  Now the network does not see them even when plugged in about 10 feet away from the airport extreme base station.  The network does recognize a totally new 2nd gen express.  Does "forget" mean forever?  How to reset?

    The network does recognize a totally new 2nd gen express.
    Then, it sounds like you have already reset the 2nd Gen Express, and now you need to set it up again, like you did the first time. Only, this time, assign the device name that you want to the AirPort Express.
    Do NOT use the name that Apple suggests.....which will be something goofy like........Sueswimsf's Red Apple AirPort Express
    Assign a simple name.....something like     2ndGenExpress

  • Firefox does not stop loading even after the site is loaded and continues as if it is still loading. I have clocked it to 15 minutes, why?

    Firefox does not stop loading even after the site is loaded and continues as if it is still loading. I have clocked it to 15 minutes, why? edit
    Details

    Sorry, I should distinguish between slow loading and manual reloading.
    I understood your problem to be that Firefox never finished loading the page, i.e., some part of the page was loading too slowly.
    By reloading, I meant Ctrl+r (or the reload button), to manually reload the page. You can disregard any cached files and reload all content fresh from the server by adding the Shift key, i.e., Ctrl+Shift+r (helpful when specific sites do not load correctly).
    If the page is automatically reloading itself over and over, that sounds like a completely different problem.

  • HT6162 My phone will not let me download the most recent update for iOS 7.1. It says I need a wifi connection and will not allow me to push the 'Download & Install' button, even when I am at home and my wifi is on. How do I fix this?

    My phone will not let me download the most recent update for iOS 7.1. It says I need a wifi connection and will not allow me to push the 'Download &amp; Install' button, even when I am at home and my wifi is on. How do I fix this?

    Unfortunately yes, though technology would never move on if it kept to older standards and did not strive to do more.
    The app store always gives you the option to use a previous version of the app IF it is available for your device.
    Sorry but you are stuck without new hardware.
    PJRS

  • How can i delete the contains of my iCloud forever? I deleted erase the files in my iPhone but they come back when i start New backup, even when i erase the files and back ups and logoff.

    How can i delete the contains of my iCloud forever?
    I deleted the files in my iPhone but they come back when i start New backup, even when i erase the files and back-ups.
    When i start a new download, the pictures come back, but they aren't in my iphone.

    wow you too never got NO answer, what nerve its worse then mobileme

  • I deleted the picture in iphoto, then emptied my iphoto trash, but the picture is still showing on my computer when i go into my trash under "all images" How do you delete pictures even when you empty the trash and they stay in the computer?

    I deleted the picture in iphoto, then emptied my iphoto trash, but the picture is still showing on my computer when i go into my trash under “all images” How do you delete pictures even when you empty the trash and they stay in the computer?

    Wtih iPhoto 9 when the iPhoto Trash is emptied the files get moved to the Trash bin in the Dock as a second chance to change your mind.  Look in the Dock's Trash bin.
    OT

  • How does c:url tag know when the session is cookieless and thus to redirect

    i have been looking at the source code for c:url tag and can't figure out how they are doing that. I need a way to do that in a jsp, to check if the cookies are allowed or not.

    how does c:url tag know when the session is cookieless and thus to redirecthuh?
    What do cookies have to do with redirecting?
    Cookies get encoded into a URL using the method in HttpServletResponse: response.encodeURL() or encodeRedirectURL().
    That method determines whether or not it prints out the session id as part of the url, or it gets uses cookies.
    You can try: request.isRequestedSessionIdFromCookie().
    If that is true, you know that session cookies are supported (or at least that one was)

  • TS1702 my camera is playing up its stuck in negative mode. even when i play a video and on youtube it plays in black/white negative mode. anyone help please?

    my camera is playing up its stuck in negative mode. even when i play a video and on youtube it plays in black/white negative mode. anyone help please?
    <E-mail Edited by Host>

    Thanks for that 'sberman' - because my iPhone is backed-up to my work computer (only at this stage) I have had to call our IT Department in Adleaide. (4 times this morning). The last guy managed to get the phone into 'DFU Mode' - no more recovery mode screen - (kind of 'asleep' perhaps) from my understanding of same. I am awaiting a call again from IT so they can get my computer to actually recognise my iPhone on the C Drive. This also happened to  one of my colleagues in Newman (WA). She got so frustrated with the whole process that she bought another phone the next time she was in 'civilisation.' She hasn't had any problems since. (Cross fingers).
    Thanks again, Sandra2474.

  • On my 3gs keep getting error message charging not supported with this accessory even when its not plugged in and i have done a restore anyone know how to fix

    on my 3gs keep getting error message charging not supported with this accessory even when its not plugged in and i have done a restore anyone know how to fix

    Clean the iPhone charging port with a clean dry toothbrush.

  • Satellite P855-10G runs out of battery even when turned off

    Hi everyone,
    I have bought the Toshiba Satellite P855-10G, but im terrified because he runs out of battery even when turned off..
    Anyone knows how can i solve the issue?
    Best regards,
    Igor Tarelho

    Hi
    Access the BIOS and turn OFF the options like: Waking up on LAN and Keyboard.
    In Toshiba HW Setup I recommend disabling the USB Sleep and Charge function as well
    Both enabled options might allow discharging the battery even if the unit is OFF

  • Why does firefox update itself even when i tell it not to? Everytime it updates itself it messes up and crashes, make it stop. I like firefox but if I keep having to unistall and reinstall it ever month to every other month I am going to be done with it

    Fire Fox updates itself even after I tell it not to. The new version it updates to crashes, adobe flash player doesn't work on it and it takes forever to load when it does work. I have used fire fox for years now but if this keeps up I will find something else to use.
    == This happened ==
    A few times a week
    == When you came out with fire fox 6.6 or whatever

    I also have this problem of Firefox updating by itself even when I turn off auto-update.
    For whatever reason, there are situations where you do not want to update or download a large file, because you're working offline, have a slow connection, or have a very low download allowance etc. Usually the update doesn't work and cause Firefox to crash. After that it cannot be started again. This is with Firefox Portable but I think I've had this problem the normal Firefox. With the portable version I can just back up a single folder but it is still time wasting and annoying.
    I've noticed that when I start Firefox with auto-update turned off, it changes the options to auto-update, it also does this periodically. So every time I start Firefox I have to turn off auto-update, and I have to do this from to time because Firefox will by itself turn back on the auto-update.

Maybe you are looking for

  • Any way to span a single iTunes Library over multiple hard drives?

    I have a hard drive that is almost full and the only thing on it is my iTunes library. It is not feasible for me to get a larger hard drive as this one is already a 1TB hard drive. Now, I have seen I can create multiple libraries, with each library o

  • Bridge beta CS3

    Love the live animation preview feature. One suggestion would be, when more images are selected in content than can be displayed on one page in preview section, to have a scroll bar appear so as to browse through them all. How about those hide arrows

  • J2IUN only showing PLA Amount balance all NIL

    Hi, We are in the implementation phase. IN J2iun, only PLA amount is displayed wheras all others are showing 0.00 Can u suggest what cud be missing in that. I searched forum for similar posts and it says extract register from J2i5, and I did that but

  • Raw or jpg in lightroom?

    Hi a stupid question about lightroom , i'm a new customer i know that i can edit raw & jpg files is there a big suitability to edit raw files in quality??? or can i edit jpg files as well like raw? thanks

  • Crystal Report is very slow to fetch the results of a Query used in Command

    Hello All, We have a query which is used in command object in Business Objects Crystal reports XI. This report is executed against IBM DB2 database. It is taking 40 min to getback the results. Here is the Query. Please suggest how can i improve the p