How does the CBO calculate the selectivity for range predicates on ROWID ?

Hi all,
I'm wondering how the CBO estimate the selectivity for range predicates based on ROWID columns.
For example, for the following query the CBO estimates there's going to be 35004 rows returned instead of 7:
SQL> SELECT count(*)
  FROM intsfi i
WHERE
ROWID>='AAADxyAAWAAHDLIAAB' AND ROWID<='AAADxyAAWAAHDLIAAH';  2    3    4
  COUNT(*)
         7
Elapsed: 00:00:02.31
SQL> select * from table(dbms_xplan.display_cursor(null,null,'iostats last'));
PLAN_TABLE_OUTPUT
SQL_ID  aqbdu2p2t6w0z, child number 1
SELECT count(*)   FROM intsfi i  WHERE  ROWID>='AAADxyAAWAAHDLIAAB' AND
ROWID<='AAADxyAAWAAHDLIAAH'
Plan hash value: 1610739540
| Id  | Operation             | Name    | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
|   0 | SELECT STATEMENT      |         |      1 |        |      1 |00:00:02.31 |   68351 |
|   1 |  SORT AGGREGATE       |         |      1 |      1 |      1 |00:00:02.31 |   68351 |
|*  2 |   INDEX FAST FULL SCAN| INTSFI2 |      1 |  35004 |      7 |00:00:02.31 |   68351 |
Predicate Information (identified by operation id):
   2 - filter((ROWID>='AAADxyAAWAAHDLIAAB' AND ROWID<='AAADxyAAWAAHDLIAAH'))According to Jonathan Lewis' book, for a normal column the selectivity would have been:
(value_column1-value_column2)/(high_value-low_value)+1/num_distinct+1/num_distinct
But here with the ROWID column, how does the CBO make its computation ?
SINGLE TABLE ACCESS PATH
  Single Table Cardinality Estimation for INTSFI[I]
  Table: INTSFI  Alias: I
    Card: Original: 14001681.000000  Rounded: 35004  Computed: 35004.20  Non Adjusted: 35004.20

Hi Jonathan,
Some Clarifications
=============
DELETE /*+ ROWID(I) */ FROM INTSFI I WHERE
(I.DAVAL<=TO_DATE('12032008','DDMMYYYY') AND (EXISTS(SELECT 1 FROM
INTSFI S WHERE S.COINT=I.COINT AND S.NUCPT=I.NUCPT AND S.CTSIT=I.CTSIT
AND NVL(S.RGCID,-1)=NVL(I.RGCID,-1) AND S.CODEV=I.CODEV AND
S.COMAR=I.COMAR AND S.DAVAL>I.DAVAL) AND I.COMAR IN (SELECT P.COMAR
FROM PURMAR P WHERE P.NUPUR=1))) AND ROWID>='AAADxyAAWAAHDLIAAB' AND
ROWID<='AAADxyAAWAAHDLIAAH'
Plan hash value: 1677274993
| Id  | Operation                      | Name    | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
|   0 | DELETE STATEMENT               |         |      1 |        |      0 |00:00:05.94 |   53247 |    |          |          |
|   1 |  DELETE                        | INTSFI  |      1 |        |      0 |00:00:05.94 |   53247 |    |          |          |
|*  2 |   HASH JOIN SEMI               |         |      1 |   9226 |      7 |00:00:05.94 |   53180 |   783K|   783K|  471K (0)|
|   3 |    NESTED LOOPS                |         |      1 |   9226 |      7 |00:00:00.01 |      10 |    |          |          |
|*  4 |     TABLE ACCESS BY ROWID RANGE| INTSFI  |      1 |   9226 |      7 |00:00:00.01 |       6 |    |          |          |
|*  5 |     INDEX UNIQUE SCAN          | PURMAR1 |      7 |      1 |      7 |00:00:00.01 |       4 |    |          |          |
|   6 |    INDEX FAST FULL SCAN        | INTSFI1 |      1 |     14M|   7543K|00:00:01.73 |   53170 |    |          |          |
Predicate Information (identified by operation id):
   2 - access("S"."COINT"="I"."COINT" AND "S"."NUCPT"="I"."NUCPT" AND "S"."CTSIT"="I"."CTSIT" AND
              NVL("S"."RGCID",(-1))=NVL("I"."RGCID",(-1)) AND "S"."CODEV"="I"."CODEV" AND "S"."COMAR"="I"."COMAR")
       filter("S"."DAVAL">"I"."DAVAL")
   4 - access(ROWID>='AAADxyAAWAAHDLIAAB' AND ROWID<='AAADxyAAWAAHDLIAAH')
       filter("I"."DAVAL"<=TO_DATE(' 2008-03-12 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
   5 - access("P"."NUPUR"=1 AND "I"."COMAR"="P"."COMAR")
When I force the NESTED LOOP SEMI JOIN the query runs faster:
DELETE /*+ ROWID(I) */ FROM INTSFI I WHERE
(I.DAVAL<=TO_DATE('12032008','DDMMYYYY') AND (EXISTS(SELECT /*+ NL_SJ
*/ 1 FROM INTSFI S WHERE S.COINT=I.COINT AND S.NUCPT=I.NUCPT AND
S.CTSIT=I.CTSIT AND NVL(S.RGCID,-1)=NVL(I.RGCID,-1) AND S.CODEV=I.CODEV
AND S.COMAR=I.COMAR AND S.DAVAL>I.DAVAL) AND I.COMAR IN (SELECT P.COMAR
FROM PURMAR P WHERE P.NUPUR=1))) AND ROWID>='AAADxyAAWAAHDLIAAB' AND
ROWID<='AAADxyAAWAAHDLIAAH'
Plan hash value: 2031485112
| Id  | Operation                      | Name    | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
|   0 | DELETE STATEMENT               |         |      1 |        |      0 |00:00:00.01 |      94 |
|   1 |  DELETE                        | INTSFI  |      1 |        |      0 |00:00:00.01 |      94 |
|   2 |   NESTED LOOPS SEMI            |         |      1 |   9226 |      7 |00:00:00.01 |      27 |
|   3 |    NESTED LOOPS                |         |      1 |   9226 |      7 |00:00:00.01 |       9 |
|*  4 |     TABLE ACCESS BY ROWID RANGE| INTSFI  |      1 |   9226 |      7 |00:00:00.01 |       5 |
|*  5 |     INDEX UNIQUE SCAN          | PURMAR1 |      7 |      1 |      7 |00:00:00.01 |       4 |
|*  6 |    INDEX RANGE SCAN            | INTSFI1 |      7 |     14M|      7 |00:00:00.01 |      18 |
Predicate Information (identified by operation id):
   4 - access(ROWID>='AAADxyAAWAAHDLIAAB' AND ROWID<='AAADxyAAWAAHDLIAAH')
       filter("I"."DAVAL"<=TO_DATE(' 2008-03-12 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
   5 - access("P"."NUPUR"=1 AND "I"."COMAR"="P"."COMAR")
   6 - access("S"."COINT"="I"."COINT" AND "S"."NUCPT"="I"."NUCPT" AND
              "S"."CTSIT"="I"."CTSIT" AND "S"."CODEV"="I"."CODEV" AND "S"."COMAR"="I"."COMAR" AND
              "S"."DAVAL">"I"."DAVAL")
       filter(NVL("S"."RGCID",(-1))=NVL("I"."RGCID",(-1)))the above post is from Ahmed AANGOUR
Case 1 - . If you check Plan hash value: 16772749938
=====
TABLE ACCESS BY ROWID RANGE| INTSFI  For every row access from INTSFI - it fetches a record from INDEX UNIQUE SCAN | PURMAR1
If we check A-rows = 9226
9226 * 7 = 64582 request across the table - perhaps with hint of rowid it fetches exact rows from PURMAR1
in this case i think going for hash join with ordered hints (jonathan as you suggest go for leading hint's instead of ordered) - from INTSFI - PURMAR1 - instead of going for IN clause would get the rows that satifies the ("P"."NUPUR"=1 AND "I"."COMAR"="P"."COMAR")
|*  2 |   HASH JOIN SEMI               |         |      1 |   9226 |      7 |00:00:05.94 |   53180 |   783K|   783K|  471K (0)|
|   3 |    NESTED LOOPS                |         |      1 |   9226 |      7 |00:00:00.01 |      10 |    |          |          |
|*  4 |     TABLE ACCESS BY ROWID RANGE| INTSFI  |      1 |   9226 |      7 |00:00:00.01 |       6 |    |          |          |
|*  5 |     INDEX UNIQUE SCAN          | PURMAR1 |      7 |      1 |      7 |00:00:00.01 |       4 |    |          |          |My understanding with above plan would change to
HASH JOIN
TABLE ACCESS BY ROWID RANGE| INTSFI
INDEX UNIQUE SCAN | PURMAR1
HASH JOIN
INDEX FAST FULL SCAN | INTSFI1
Which migt be feasible.
2 .
DELETE /*+ ROWID(I) */ FROM INTSFI I WHERE
(I.DAVAL<=TO_DATE('12032008','DDMMYYYY') AND (EXISTS(SELECT /*+ NL_SJ
*/ 1 FROM INTSFI S WHERE S.COINT=I.COINT AND S.NUCPT=I.NUCPT AND
S.CTSIT=I.CTSIT AND NVL(S.RGCID,-1)=NVL(I.RGCID,-1) AND S.CODEV=I.CODEV
AND S.COMAR=I.COMAR AND S.DAVAL>I.DAVAL) AND I.COMAR IN (SELECT P.COMAR
FROM PURMAR P WHERE P.NUPUR=1))) AND ROWID>='AAADxyAAWAAHDLIAAB' AND
ROWID<='AAADxyAAWAAHDLIAAH'Ahmed AANGOUR, modified the query by /*+ NL_SJ */ hint, Instead of that in to remove the most of the rows as we join the tables using subquery, I still doubt it
to go push_predicate hints - still doubt it.
Jonathan your comments are most valuable in the above two cases..
Looking forward to calrify my understanding with concepts of indexes for above test cases
- Pavan Kumar N

Similar Messages

  • How does Mac OS calculate the charging Cycle count?

    Hello, Guys
    How does Mac OS calculate the charging Cycle count? I just used my MBP for about 15 min without power plugged in and I saw it left about 90% battery. However after the battery be recharged, I checked system profiler. It shows charging cycle count increased 1. I do remember that last time I left almost the same percentage of battery and plugged in. After the battery was fully charged, profiler did show cycle count increased.
    So I am wondering How does Mac OS calculate the charging Cycle count? Basing on the percentage left or something else?
    Thanks,

    Ok,
    But does it count continuously or separatly? I mean One time I used 10% and recharged full; and next time I used 20% and fully recharged again. Does the OS increase the cycle count when the usage adds up to 100% no matter how many times of recharge?
    Thanks,

  • My table of contents does not use the entry style I select for words in the paragraph that have character styles applied to them in the chapter, so some of the letters are showing up as green, which is fine in the chapter but not in the TOC.

    My table of contents does not use the entry style I select for words in the paragraph that have character styles applied to them in the chapter, so some of the letters, specifically parameters, are showing up green, which is fine in the chapter but not in the TOC. I can manually fix this in the TOC by changing the character style to none after the toc  has been generated, but I don't want to do this.

    What application are you running? Please ask this in the forum of the product you're using.

  • HT204053 How does my spouse get the benefits of using my iCloud for contacts and calanders but not messages, etc?

    How does my spouse get the benefits of using my iCloud for contacts and calanders but not messages, etc?

    iCloud is designed for personal use and not for managing multiple access.  If you gives your password to someone else, this person can benefit everything including access to purchase with your account, email, etc.
    You should rather consider having each one an iCloud account and then, create and share a calendar.  As for contact, you can send them to your spouse to be save in her account but they cannot be shared nor synced.

  • Sorry if tis is naive.  I have just bought my first iPad Retina Display.  I have WiFi at home but it has taken ages for me to connect as I needed all sorts of codes, passwords, detauils etc.   How does one connect to the web (Google) when one is out and a

    Sorry if this is a bit naive.  I have just bought my first iPad (Retina Display).  I have WiFi at home but it has taken me ages to get on-line as I needed all sorts of codes, passwords, numbers etc.
    How does one connect to the web (Google) when one is out and about?
    Thanks

    haha, You're welcome
    Maybe these links will be useful
    ipad manual/user guide
    http://manuals.info.apple.com/en_US/ipad_user_guide.pdf
    ipad support page
    http://www.apple.com/support/ipad/
    ipad assistant
    http://www.apple.com/support/ipad/assistant/

  • How does condition category affect the price procedure

    Hello Gurus,
         there is a case as following:
    if the condition type in the pricing analysis says in a billing document that the ‘‘condition is found and set,” and one is using the condition requirement number 024 (which only determines the price in billing document) yet still has to do new pricing in order to obtain the condition record, Should the condition category be blank, the system would propose the message “condition is found and set” but does not provide an actual condition record.
       the fault would be that the condition category on the condition type should be equal to L.
       so my question is " how does condition category affect the price procedure" ? thanks very much!

    Hi Zhang,
    -->Condition category is a classification of conditions according to predefined criteria.
    -->These categories include packaging costs, delivery costs, output taxes and discounts.
    -->The classification of conditions by condition categories can be used for analysis.
    I hope it will clear for you
    Regards,
    Murali.

  • HT4314 i'm new and i don't know haw to access a new crossword puzzle, the one i already completed keeps coming up...how does one get to the next puzzle?

    in crosswords how does one advance to the next puzzle please, thanks

    Re: That garbage is unreadable.
    If you really want help, stop messing with the fonts and post so that others can read and offer suggestions.
    Or better yet... try a search, I'm certain you'll find a solution to whatever issue you're experiencing.
    I have found that many times it is the things that make you most angry that push you to action. This was the case here. Thank you for causing me to get so angry that I found the answer myself.

  • How does waveform graph downsamples the data before it is plotted

    Hi,
    I'm interested in how does waveform graph downsamples the data before it is plotted and what algorithm is used for this purpose? My goal is to plot 30 plots that have 1M samples each and I would like to downsample them before plotting onto a graph. I tried several VIs/algorithms for resampling and none of them gave the same result as seen by waveform graph (when all the samples are plotted).
    For example, if only one sample of 1M samples is 1 and all others are 0, then after downsampling to 1k samples the sample is not visible on the graph anymore. However, if I plot all 1M samples directly onto the graph, then also this 1 sample is visible (see attached example). 
    Solved!
    Go to Solution.
    Attachments:
    WFGDownsampling.vi ‏19 KB

    Hi andrej,
    LabVIEW draws plots in the way that draw every pixel affected by signal. So for example if there is zero-valued 1M samples and even one equals to 1, you will see the peak. That is the reason why you do not get the exactly same behavior comparing to interpolating. But if you set FIR as interpolation mode in Resample Waveforms (single shot).vi, result is really similar, but of course amplitude is 1000-times smaller than original one (because there is dt set to 1000). Keep also in mind that in Graph 2, there is different Y-scale and it should be considered as noise, not relevant data, I would expect 1000-times smaller amplitude as in Graph 3, it is many more times smaller.
    I would also like to say something about downsampling (decimating) the data. If you have 1M samples, you can see the peak even that there is only one value. But bigger problem is that with this graph resolution (I guess that is not more than 1000px), it is problem to find position of this peak. It means that still the zoom is needed to know where the peak is. Usually, when there is that big set of data, you are extracting different data (statistical information, peaks in FFT, etc.) not just visual data in graph.
    Mariaaa:
    I do not understand your question, can you please describe more your needs? You mentioned saving the data into a file, you can use Write to Measurement File express VI or see Write to Text File.vi in Example Finder and try to appropriately modify it.
    Best regards,
    Martin

  • How does apple know what the fault is with my iphone?

    How does apple know what the fault is with my iphone when sending it to them on apple care. My sleep/ wake button seems to be stuck so I sent in for a repair on the website and they sent me a apple care box and said send it back but I Carnt remember if I told them the fault or do they know by the repair ID number? Please help as I'm sending it off in a couple of day.

    Include a note in the shipping box describing in detail the issue you have with the phone. Include your name, address, phone number, email, iPhone model and serial number, and a detailed explanation of the problem.

  • How does dust get in the screen?

    ad for two years and noticing dust in the screen, for example a pretty big dust dot that can be seen on white or light backgrounds.
    How does dust get in the screen? The middle of the screen? And will it eventually go away?
    Is it through the vent? Like how does dust get in?

    Is there an AASP near you?  AASP's Outside of the USA 
    How to find your nearest Apple Authorized Service Provider (AASP)
    Apple does repairs on all of their products.  Either way, if you are out of warranty, you will be responsible for all repairs no matter who does the repairs. 
    If you want to try DIY repairs - Do-It-Yourself Laptop Repair 
    Research YouTube's 'How To' video tutorials
    FixYa

  • How does one tell if the J2EE services are running with Unlimited

    How does one tell if the J2EE services are running with Unlimited
    security? We have applied the export Policy to the server but we do notsee any reference to it running with it. .we apply the Service packs SAP now upgrades that JAVA as well . Do that process treat the JAVA
    lib/security area correctly.

    Just out of curiosity... Is there something you do
    like about Mac/Apple?
    To answer your question: no, not really. However, the points that I made here were about Safari and accompanying utilities, not about Apple in general.
    If it makes you feel any better, I am just as, or even more, critical of Micro$oft as the occasions arise...Windoze Vista is the most recent occasion and has given sufficient reasons and opportunities to vent my spleen that I actually have eased up on Apple, politicians, nut-case religious extremists, cell phone owners, and the Department of Homeland Paranioa, etc., due to an exhaustion of creative energy.

  • How does one know if the latest Camera Raw is included Photoshop CC?

    How does one know if the latest Camera Raw is included  with Photoshop CC?

    Help>About Plug-In>Camera Raw...

  • How does Imac connect to the internet?

    How does Imac connects to the internet?

    Through your ISP (internet service provider); once you set up an account with them, you can decide to connect via ethernet cable to their modem, or, if you have a router (which is connected to their modem, you can connect wirelessly.
    Is that what you were wondering about or did I misunderstand your question?

  • When using time capsule on a PC based network, how does it appeare on the network ? like a normal shared external HDD ??? or what ?

    when using time capsule on a PC based network, how does it appeare on the network ? like a normal shared external HDD ??? or what ?

    Yes, it will show you the main directory.. so if you link in windows explorer it will be..
    \\TCname\data
    Or \\TCipaddress\data
    Data can be whatever name the main (root) directory of the TC is called.

  • How does production system takes the benefits of user exits

    hi
    could anybody tel me
    how does production system takes the benefits of user exits

    Hi,
    you have to transport your implementation to your production system.
    Regards
    Bernd

Maybe you are looking for

  • PowerBook gone wild with new battery

    My son just got a hand-me-down G4 1.5Ghz 15" PowerBook at work. When he got it the battery would not hold a charge for more than about 5 minutes. We checked the serial number and it was part of the PowerBook battery recall so we requested a battery e

  • Problem with dual graphic

    I own HP PAVILION G6 1202TX model.It is built with dual graphics INTEL and RADEON. INTEL - INTEL(R) HD Graphics 3000 and AMD- RADEON(TM) HD 6470M.earlier accidently i lost my windows and its all drivers but my main issue is with ts graphics.If i inst

  • How to get Iphone off of recovery mode

    Hi everyone! I'm in need of some help. My iphone 5s battery recetlenty died and I only charged it the next day. When I plugged it in, it showed the usual battery that is empty and red. I did'nt realize a problem until the screen turned white with que

  • Export Image to Clipboard Crash

    Has anyone else had any problem with the Export Image when Clipboard is the selected target.  It works fine for me as part of the development environment but crashes the program when used as part of a built executable. (LabVIEW 8.5)

  • IMac to Macbook Pro as extended desktop. Will they work together?

    Can I use my iMac as an extended desktop with my MacBook Pro? Or vise versa? iMac is late 2009 and MacBook is late 2013. The iMac has a mini display port and the MacBook has a thunderbolt port. Can I make the connection with a thunderbolt cable?