Why isn't the CBO using my indexes?

Why isn't Oracle using my indexes to join 2 big tables? I ran statistics last night before kicking off this job. I don't want to have to use hints.
STAGING_TXN_081 has Primary Key on VSYS_STAGE_ROW_ID
TRANSACTION has an index on STAGING_RECORD_ID
Record counts are as follows:
SQL> select count(*) from STAGING_TXN_081;
COUNT(*)
613071
1* select distinct count(staging_record_id) from transaction
SQL> /
COUNT(STAGING_RECORD_ID)
10,662,828
1* select distinct count(*) from transaction where staging_record_id is null
SQL> /
COUNT(*)
1,150,819
So 1,150,819 / 10,662,828 = approximately 10.8% of the rows are null.
This is the Query
select
    st.*,
    rlog.reject_code as rlogRejectCode
from       
    STAGING_TXN_081 st
    join transaction t
        on st.VSYS_STAGE_ROW_ID = t.STAGING_RECORD_ID
    left outer join txn_reject_log rlog
        on t.transaction_id = rlog.transaction_id
where
    not exists
    (select 1
    from
        rl_loyalty_txn_trans rl
        join loyalty_txn lt
            on lt.loyalty_txn_id=rl.loyalty_txn_id
    where
        rl.transaction_id=t.transaction_id)
order by st.VSYS_STAGE_ROW_ID, rlog.reject_code Here is the execution plan.
Execution Plan
Plan hash value: 447420266
| Id  | Operation                     | Name                    | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT              |                         |     1 |   223 |       |   144K  (6)| 00:29:00 |
|   1 |  SORT ORDER BY                |                         |     1 |   223 |       |   144K  (6)| 00:29:00 |
|   2 |   NESTED LOOPS OUTER          |                         |     1 |   223 |       |   144K  (6)| 00:29:00 |
|*  3 |    HASH JOIN ANTI             |                         |     1 |   203 |   121M|   144K  (6)| 00:29:00 |
|   4 |     VIEW                      |                         |   613K|   114M|       | 84466   (7)| 00:16:54 |
|*  5 |      HASH JOIN                |                         |   613K|    71M|    72M| 84466   (7)| 00:16:54 |
|   6 |       TABLE ACCESS FULL | STAGING_TXN_081         |   613K|    65M|       |  3237   (5)| 00:00:39 |
|*  7 |       TABLE ACCESS FULL | TRANSACTION             |    10M|   111M|       | 65229   (7)| 00:13:03 |
|   8 |     VIEW                      | VW_SQ_1                 |    10M|    69M|       | 44389   (6)| 00:08:53 |
|*  9 |      HASH JOIN                |                         |    10M|   197M|   192M| 44389   (6)| 00:08:53 |
|  10 |       INDEX FAST FULL SCAN    | PK_LOYALTY_TXN          |    10M|    71M|       |  7314   (7)| 00:01:28 |
|  11 |       INDEX FAST FULL SCAN    | PK_RL_LOYALTY_TXN_TRANS |    10M|   128M|       | 13947   (4)| 00:
|  12 |    TABLE ACCESS BY INDEX ROWID| TXN_REJECT_LOG          |     1 |    20 |       |     3   (0)| 00:00:01 |
|* 13 |     INDEX RANGE SCAN          | VIDX_309                |     1 |       |       |     2   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   3 - access("TRANSACTION_ID"="from$_subquery$_003"."TRANSACTION_ID")
   5 - access("ST"."VSYS_STAGE_ROW_ID"="T"."STAGING_RECORD_ID")
   7 - filter("T"."STAGING_RECORD_ID" IS NOT NULL)
   9 - access("RL"."LOYALTY_TXN_ID"="LT"."LOYALTY_TXN_ID")
  13 - access("T"."TRANSACTION_ID"="RLOG"."TRANSACTION_ID"(+))
Statistics
        467  recursive calls
          0  db block gets
     324842  consistent gets
     249318  physical reads
          0  redo size
        955  bytes sent via SQL*Net to client
        240  bytes received via SQL*Net from client
          1  SQL*Net roundtrips to/from client
          1  sorts (memory)
          0  sorts (disk)
          0  rows processed

Hi,
Take these points in consideration
- STAGING_TXN_081 has to be full table scanned as there is NO filter on that
- if all the matching 613071 rows from the TRANSACTION table are in different blocks, it might be equivallant to reading full TRANSACTION table (Oracle read blocks not rows)
- if we are reading all blocks from TRANSACTION table anyway, why waste resources in reading the index blocks
- How can we tell Oracle that, required TRANSACTION records are not located like 'each row in different block' ??? if that is really the case !!!
- Your 'not exists' clause, how may records from TRANSACTION table will be filtered out because of that
- If the 'not exists' will take out huge number of rows, I would suggest creating a in-line view of TRANSACTION table and the 'not exist' logic and then joining that with the STAGING*** table
- Try to minimise the number of rows taking part in these joins (I know, I am not telling anything new here !!!)
Cheers

Similar Messages

  • I have deleted all emails from my ICloud email account but my manage storage still shows that the mail is using 9.7GB.  Why isn't the number decreasing if all emails have been deleted?

    I have deleted all emails from my ICloud email account but my manage storage still shows that the mail is using 9.7GB.  Why isn't the number decreasing if all emails have been deleted?

    It might be caused by storage "buffering".  If so, the space will adjust automatically when another iCloud feature uses the space previously allocated to your deleted email.  See http://support.apple.com/kb/HT4873.

  • Whenever I go to preview a song in itunes, the song with play out for about 10 seconds and then stop. Why isn't the song previews working? How can I fix this? I tried updating my itunes and it didn't work.

    Whenever I go to preview a song in itunes, the song with play out for about 10 seconds and then stop. Why isn't the song previews working? How can I fix this? I tried updating my itunes and it didn't work. I use windows 7. Thanks!

    Try:                           
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try another cable
    - Try on another computer                            
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar                                     

  • Why isn't the apogee working

    Downloaded new version of garage band and now my apogee isn't working

    webmail-user wrote:
    I get annoying spam in the Spam Detector from a sender that I will refer to as XYZ for this question. Using Settings/Email Settings/Filters, I added a new filter "If From Contains XYZ delete" and saved the new filter. Today I got another spam in the Spam Detector from the same XYZ sender. Why isn't the filter causing this email to be automatically deleted? Thanks for any suggestions.
    I think that the Spam Detector runs before your custom filters, and custom filters only work on the inbox folder. If Spam Detector moved it from the inbox before the filters were run, then the filter wouldn't delete it.
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem.
    "All knowledge is worth having."

  • Why isn't the filter working?

    I get annoying spam in the Spam Detector from a sender that I will refer to as XYZ for this question. Using Settings/Email Settings/Filters, I added a new filter "If From Contains XYZ delete" and saved the new filter. Today I got another spam in the Spam Detector from the same XYZ sender. Why isn't the filter causing this email to be automatically deleted? Thanks for any suggestions.

    webmail-user wrote:
    I get annoying spam in the Spam Detector from a sender that I will refer to as XYZ for this question. Using Settings/Email Settings/Filters, I added a new filter "If From Contains XYZ delete" and saved the new filter. Today I got another spam in the Spam Detector from the same XYZ sender. Why isn't the filter causing this email to be automatically deleted? Thanks for any suggestions.
    I think that the Spam Detector runs before your custom filters, and custom filters only work on the inbox folder. If Spam Detector moved it from the inbox before the filters were run, then the filter wouldn't delete it.
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem.
    "All knowledge is worth having."

  • Why isn't the edit button not showing in my ESX24 sampler?

    why isn't the edit button not showing in my ESX24 sampler?

    Is that during installation when you see the two icons.. the one on the left looking like a Garageband guitar icon, the one on the right like the Logic Pro platimum record icon?
    Yes.. that one.. with the choice to click on which option you want/are coming from...
    p.s. I'll probably aquire a Mac Mini this fall then upgrade.... I mean repurchase!
    I think I managed to grab one of the last of the 2011 refurb'ed MMS's.... at that super low price Apple were selling them for... before they bumped it up and now, they seem to have none left at all at any price
    However, just in case, I have found this site really useful at keeping track of Apple's refurb stock... and pricing
    http://www.refurb.me/us/

  • Why isn't the song i downloaded not on my Ipod?

    why isn't the song i downloaded not on my Ipod?

    Does any media sync to the iPod?
    Was the iPod previous synced to another iTunes library/computer?
    Have you successfully synced from this iTunes library/computer before?
    Do the songs play in iTunes?          
    Do you have the right boxes checked to sync?
    iTunes: Syncing media content to iOS devices and iPod       
    Try syncing using the manual method                
    Do you have any Restrictions (Settings>General>Restrictions) set that would prevent syncing those songs? (iTunes purchases only)

  • Why isn't the radio tuning service working on itunes?

    Why isn't the radio tuning service working on itunes? I get an error message on all of our Macs.

    Maybe one of the 300+ posts about this in the last few days has the answer.  Browse the forum.
    If you wish to, you can report to Apple.
    http://www.apple.com/feedback/itunesapp.html

  • Why isn't the plugin checker working anymore?

    I check for updates to my plugins very often. The Plugin Check page has been saying that all my plugins are up to date. However, twice now I've clicked the button to check anyway, and found that a plugin was not up to date after all. Why isn't the Plugin Check page detecting when my plugins need updating?

    I don't know what you guys have been doing at Mozilla but you've ruined a decent product!

  • Why isn't the iMessage working on my phone? Up until 1:45pm today it was fine, but now it isn't working.

    Why isn't the iMessage on my iPhone 4s working? Up until about 1:45PM today it was working just fine but now it sends it as a text message. I have tried everything in the setting but it still is not working. Any tips would be great! Thanks!

    It should be back up now, they had a system outage. Reset your iPhone.

  • Why isn't the Apple store working?

    Why isn't the Apple store working? I wanted to buy a iPad but I can't because the store isn't working. When will the store start working?

    Apple is in the midst of announcing new products and they normally take the Apple Store offline while a keynote is in progress. The Apple Store will be back up when the keynote is over. Try back in about a half an hour or so.
    Regards.

  • Why isn't the Youtube app on my iPod?

    Why isn't the Youtube app on my iPod?

    I also think that it was a mistake for them to take away the Built in YouTube Application but you could always try to download it from the App Store because their is now an YouTube app i have tried it and it works fine but it is just not the same as the Built in one
    Hope this solves your issue
    Hope they bring back the Built in YouTube App on the next IOS Update.
    Best of Luck

  • Why isn't the App Store and iTunes a choice for an app on my mini?

    Why isn't the App Store and iTunes a choice for an app on my mini?

    Either they've been moved to another home screen or dropped in a folder, in which case doing a search or resetting the Home Screen layout (Settings/General/Reset) should bring them up, or they've been turned off in General/Restrictions.
    Regards.

  • Why isn't the App Store letting me install and update apps to my iPod Touch 3 Gen.?

    Why isn't the app store letting me update or install Apps?

    Because like a computer, you always need more space that the download size takes up.  One reason is that the app needs to be expanded to be installed.

  • Why isn't the first generation iPad not supported by iOS 6?

    I am totally confused. Why isn't the first iPad supported in iOS 6?
    iPad 1: Apple A4 1GHz processor and 256 mb RAM
    iPod Touch 3G: 800 MHz processor (same as iPhone 3GS) and 256 mb RAM
    iPhone 3GS: 800 MHz processor (underclocked to 600 i believe)

    3GS is still sold officially and new. iPad first generation isn't. Android is even worse about things like this.
    PLEASE don't branch this into twenty different threads, and keep it in the two that already exist.

Maybe you are looking for

  • Javascript "Play Video" button not working in Firefox

    When clicking on "play video" (java), QuickTime will not open while using firefox. It does work in Google Chrome and IE. I have tried using a clean user profile & allowing popups, and I made sure the Java and QuickTime addons were working and up to d

  • Support: Searching for PC audio connection (TV:32W2333)

    HI, I just bought a 32W2333 LED TV and I was trying to connect my computer. I need to do it with a monitor PC cable and I bougth the TV because I saw it has a PC connection slot (RGB/PC connector in the back of the TV). But I was unable to find the s

  • Different Payement terms & Incoterms

    Hi friends I have 2 orders with respective deliveries. Payment terms and Incoterms are different from 1st order to 2nd order. Now can we get SAME INVOICE NUMBER for both the deliveries?? Urgent pleasee. Regards Ramesh

  • Best workflow for slow motion from Canon 7D?

    Hey guys, I am working with a slow motion clip for the first time and I am realizing that there isn't really an easy workflow with this. First of all, the clip was filmed with the Canon 7D, 60 fps. When I put in on the timeline, obviously I get rid o

  • ADOBE interactive form for PCR in MSS

    Hi all, i am trying to apply a PCR throug portal but if i open the form for submiiting the request for change in PA and PSA, in the form PA PSA to be selected are disabled pls tell how to enable that ??? is there any problem with config...please tell