Two cols index used when "col1=:1" but not when "col1 is null"(same cardin)

Hi everybody,
here is my test case (Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi):
DROP TABLE TEST;
CREATE TABLE TEST AS SELECT RPAD('X',100,'X') X, (CASE WHEN MOD(ROWNUM,10)=0 THEN CAST(NULL AS NUMBER) ELSE MOD(ROWNUM,10) END) Y, ROWNUM Z FROM DUAL CONNECT BY LEVEL<=10000;
SELECT Y, COUNT(*) FROM TEST GROUP BY Y ORDER BY 1;
create index test_idx on test(y,z);
exec dbms_stats.gather_table_stats(ownname=>'&_USER', tabname=>'TEST', method_opt=>'for all columns size REPEAT', cascade=>true, no_invalidate=>false);
select * from (select z from test where y=1 order by z) where rownum <= 10;
select * from (select z from test where y is null order by z) where rownum <= 10;So there are 1000 records per Y column value:
SQL> SELECT Y, COUNT(*) FROM TEST GROUP BY Y ORDER BY 1;
         Y   COUNT(*)
         1       1000
         2       1000
         3       1000
         4       1000
         5       1000
         6       1000
         7       1000
         8       1000
         9       1000
                 1000
10 filas seleccionadas.So, what I don't undertand is why in the second query from below, the index is not used:
  select * from (select z from test where y=1 order by z) where rownum <= 10
Plan hash value: 2425049421
| Id  | Operation          | Name     | Starts | E-Rows | Cost (%CPU)| A-Rows |   A-Time   | Buffers |
|*  1 |  COUNT STOPKEY     |          |      1 |        |            |     10 |00:00:00.01 |       3 |
|   2 |   VIEW             |          |      1 |     10 |     2   (0)|     10 |00:00:00.01 |       3 |
|*  3 |    INDEX RANGE SCAN| TEST_IDX |      1 |     10 |     2   (0)|     10 |00:00:00.01 |       3 |
Predicate Information (identified by operation id):
   1 - filter(ROWNUM<=10)
   3 - access("Y"=1)
  select * from (select z from test where y is null order by z) where rownum <= 10
Plan hash value: 2549875903
| Id  | Operation               | Name | Starts | E-Rows | Cost (%CPU)| A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
|*  1 |  COUNT STOPKEY          |      |      1 |        |            |     10 |00:00:00.01 |     161 |       |       |          |
|   2 |   VIEW                  |      |      1 |   1000 |    43   (5)|     10 |00:00:00.01 |     161 |       |       |          |
|*  3 |    SORT ORDER BY STOPKEY|      |      1 |   1000 |    43   (5)|     10 |00:00:00.01 |     161 |  9216 |  9216 | 8192  (0)|
|*  4 |     TABLE ACCESS FULL   | TEST |      1 |   1000 |    42   (3)|   1000 |00:00:00.01 |     161 |       |       |          |
Predicate Information (identified by operation id):
   1 - filter(ROWNUM<=10)
   3 - filter(ROWNUM<=10)
   4 - filter("Y" IS NULL)Any clue?
Thanks.
Joaquin Gonzalez

Hi,
Null values are not stored in the index, so if you use "col is null" as a predicate there is no entry on the index and so no pointer to the actual row hence the full table scan.
If you query USER_INDEXES and look in the DISTINCT_KEYS column for your index, you should see that there are only 9 keys.
e.g.
SQL> create table nt as
  2  select decode(m, 0, null, m) v from
  3* (select mod(level,10) m from dual connect by level <= 10000)
SQL> /
Table created.
SQL> select v, count(*) from nt group by v order by v ;
V                                          COUNT(*)
1                                              1000
2                                              1000
3                                              1000
4                                              1000
5                                              1000
6                                              1000
7                                              1000
8                                              1000
9                                              1000
*NULL*                                         1000
10 rows selected.
SQL> create index nt_i on nt (v) ;
Index created.
SQL> analyze table nt compute statistics
  2  /
SQL> select distinct_keys from user_indexes where index_name = 'NT_I'
SQL> /
DISTINCT_KEYS
            9Edited by: Steve_B on 06-Jul-2009 02:30

Similar Messages

  • HT5105 I have been trying to create a multicam clip from two camera's. They sync properly when using the sync feature but not when I use the multicam feature does anyone know what I may be doing wrong?

    I have been trying to create a multicam clip from two camera's. They sync properly when using the sync feature but not when I use the multicam feature does anyone know what I may be doing wrong?

    Probably best if you could post screen shots of the Inspecror window in extended view with a couple of the clips you using for the 2 angles.
    If you have audio from both cameras and have identified them separately, the sync is usually pretty reliable.
    Russ

  • Adobe form-Able to post  data using Adobe Reader 9 but not with Adobe Proff

    Hello Guru's
    I am facing one problem with adobe forms.
    We have develoed a adobe form using adobe reader 9.
    Now when user are posting the purchase requistion using the form,they are able to post the data using
    Adobe Reader 9 but not with Adobe Reader professional.
    Can anyone please advice me what can be the problem here.

    Adobe Reader 9 can't save the old FDA forms. FDA must update their forms.

  • Editing a movie that was already cut together without transcoding .h264 footage to proresslt. I want to transcode full clips that are used in the edit, but not any of the leftovers.

    Editing a movie that was already cut together without transcoding .h264 footage to proresslt. I want to transcode full clips that are used in the edit, but not any of the leftovers. Is there an efficient way to this?
    I'm thinking I can convert the files with Compressor and place them in a new folder with their original file names (not sure how to get compressor to do this yet) and then do a major "Reconnect Clip" afterwards.
    Not sure if there's a more efficient way to get all the clips in the timeline to compressor. I want the full files, not a sequence export. I can go through one clip and a time and add the master file. I'd rather not.
    The more automated processes the better.
    Thank you. I'm currently working so I don't have the time to scour the forums. Help or links to help would be greatly appreciated.
    B

    yeah Media reconnect can be an issue.
    Will Media Manager convert files? Another thing I was thinking was to Media Manage the sequence out, copying all the used files to a new folder, and then running that through compressor. But it still leads to a massive reconnect. Fine tuning all those edits would be less involved than re-editing the whole thing, I hope.

  • I am wanting to print my iCal calendar, as use it for bookings but not include entries calendar from other people who I've synced with.

    I am wanting to print my iCal calendar, as use it for bookings but not include entries calendar from other people who I've synced with.

    GACU,
    OK, now I think I understand your problem.
    If it is your calendar that is being shared with other users who have been granted editing priviliges, you will not be able to exclude those events from printing.

  • "No connectivity with the server" error for one document but not the other, in the same document library

    We have a number of users all of a sudden getting "No connectivity with the server.  The file 'xxx' can't be opened because the server couldn't be contacted." errors trying to open MS Office docs (Word, Excel, etc.) in SharePoint with IE,
    just by clicking the link and selecting the "Read Only" option.  If they select the "Check Out and Edit" option, they can open the document no problem.  One of my customers gets the error on one document but not the other, in
    the same document library!  The older document (a weekly report) was copied and renamed as per standard procedure.  She can read the older document, but not the new one.
    It is definitely a profile issue, as other people have logged onto the machines of the users with problems and do not get the error.  We have also renamed people's c:\user profile folders and the corresponding Profilelist registry entry and the newly
    created profile does not experience the error for these people.  Renaming the profile back restores all their personal settings but the error reappears.  When we copied the old profile's folder structure into the new profile, many of the user settings
    were restored (but not all, like Dreamweaver settings) but the error did not appear.  We think that the system folders files (like AppData) weren't totally copied over so we're going to run another test using xcopy.  We are rebooting between
    logons to make sure all files are unlocked.
    The laptops and computers are mainly 32bit, Win7 Enterprise running IE9 and Office 2010 Professional Plus, but there's a few 64bit machines as well. The SharePoint farm has 1 WFE, 1 App Server running search and CA, and a shared database server running SQL
    2005 SP4.  SharePoint is 64bit MOSS 2007 with the latest CU.
    We've checked the logs on the client as well as on the server and there aren't any helpful entries.  We've also run Process Monitor, also with no helpful entries.  We're planning to run something like Fiddler next.
    It's not everyone, because there are many people are accessing the SharePoint system and the same files.  It is also not a permission thing, as we've tested by giving the users elevated permissions with no changes.  One person experiencing
    the errors is a Site Collection Admin.  That same person ran a test where I coped a simple Excel file into a Document Library which contained a problem file.  They were able to open it Read Only no problems that day, but the next day, the same
    file gave them an error.   In their case, they usually get a "xxx is not checked out" error and only occasionally get the "No connectivity with the server" error.
    We've tried lots of things including:
    Deleting IE cache
    Deleting SharePoint Drafts and webcache folder contents
    Running IE without add-ons
    Upgrading and Downgrading IE
    Uninstalling and re-installing IE
    Reinstalling our SSL certs
    Repairing Office
    Removing and then adding back in the Microsoft Office "Microsoft SharePoint Foundation Support" Office Tool 
    Deleting all HKLM and HKLU Office registry settings
    Toggling IE Compatibility Settings
    Toggling the IE Automatic Logon option
    Toggling the location of checked out files
    Adding the site in the trusted sites list
    Adding the site to the WebClient\Parameters registry locations
    Making sure the WebClient service is started
    Rebooting the machine (lol :)
    This is becoming a serious issue, not just because of the inconvenience for the users having to check out every document they want to read, but we have some files with macros that open up other documents to run which are now failing.  There aren't
    "check out" workarounds for some of those macros.
    We're planning to open a ticket with Microsoft, but I'm throwing it out here first in case someone has run into this before, or may have some suggestions on what to try next.  Thanks!
    -Richard.
    PS  I think this needs to be in the "General" forum instead?

    It took three days of dedicated troubleshooting, but I have found the cause of the errors, and a couple of fixes.  It helped tremendously that my own machine was throwing the error.  I have scheduled a couple of users to work with me to test the
    various fixes, to see which one works best, so the story isn't over yet.
    I had backed up my c:\users profile folder and HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList registry key so I could restore my profile after I was done.  I made a copy of the profile folder and was using that for awhile,
    but then made another copy where I had deleted a lot of content out of it so that the copies would go faster.  Since a newly created profile did not have errors, I was trying to copy back as much of the profile as possible to make it easier for our users
    to get back to work.  Instead of blowing away their profile and starting from scratch (which we know worked) I wanted to narrow down what was causing the error and just skip that from the restore.  The concept was to keep as much as the users profile
    in tact (application settings, etc.) not just restoring their desktop and My Documents folders.
    When we first tested a few weeks ago, simply copying the folder contents didn't reproduce the error.  I then tried xcopy, but got the "can't read file" error.  Then I tried robocopy, and ran into the "junction" problem. 
    I went back to xcopy, and found that placing the excludes.txt file in the windows/system32 folder eliminated the error.
    So the process went as follows: 
    Reboot and log into the machine as another user
    Delete the profile and associated registry key
    Reboot and log into the machine as the affected user, creating a new profile, and there is no error
    Reboot and log in as the other user
    xcopy the contents of the skinned-down backed-up profile to the newly created profile
    Reboot and log in as the affected user, and the error occurs
    Repeat the above, but add items in the excludes.txt file to see what, when eliminated, causes the error not to appear in the last step
    I eventually found that skipping the c:\users\<profile folder>\appdata\local\Microsoft\office\14.0 folder allowed the entire profile to be copied over without the error occurring.  That was strange, because we've cleaned out the cache folders
    before which didn't fix the issue. 
    So I went about it the opposite way, and tried to delete the 14.0 folder from the restored profile, and after reboot, the error still occurred.
    What eventually worked was deleting the 14.0 folder and copying over a 14.0 folder from a newly created profile!
    One way to do this was to:
    Reboot and log in as another user
    Rename the c:\users profile folder
    Rename the appropriate [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList] registry key
    Reboot and log in as the affected user, confirm that there is no error
    Reboot and log in as the other user
    Copy the C:\Users\<profile folder>\AppData\Local\microsoft\Office\14.0 folder to the other user's desktop
    Delete new profile folder, and rename the backup to be the production folder
    Delete the C:\Users\<profile folder>\AppData\Local\microsoft\Office\14.0 folder and then paste the 14.0 copy from the desktop
    Reboot and log in as the affected user, confirm that there is no error
    We've tried this on a couple machines and it works.  I had to run Windows Explorer as Administrator to access the other profile's folders.
    We've also successfully copied a 14.0 folder created by one profile on one affected computer over another profile's folder on another computer, eliminating the error, so we're trying that first, as that is fewer steps.
    We may attempt to script this, but the self-help instructions are only 5 lines long:
    Reboot and log into the affected computer with another account
    Go to <link to location of 14.0 folder on network> and copy the 14.0 folder
    Run Windows Explorer as Administrator
    Go to c:\users\<profile folder>\appdata\local\microsoft\office and delete the 14.0 folder, and paste the copied 14.0 folder (trying to overwrite it makes Win7 want to merge the folders)
    Reboot and log into your normal account, and confirm the error is gone
    I'll come back and report after we go into the field with this fix, but after the few tests, I am cautiously optimistic that this is it.

  • All of a sudden, emails adressed to me are received on my iPhone, but not on my MacBook. Same email address. Can somebody help? Thanks

    All of a sudden, emails adressed to me are received on my iPhone, but not on my MacBook. Same email address. Can somebody help? Thanks

    You cannot, all content is tied to the Apple ID used to obtain them.
    Content from one Apple ID cannot be merged or transferred to another Apple ID.
    You need to recover your Apple ID for updates.
    https://iforgot.apple.com

  • Why is my TV screen blank when I try to Use mirroring on iPad but not iphone

    BBlank screen on tv when using mirroring on iPad and not iPhone

    Hello Peteach1,
    Welcome to the Apple Support Communities! You can use the steps in the following resource if you are experiencing issues with AirPlay mirroring on your iPad:
    Resolve issues with AirPlay and AirPlay Mirroring from iPhone, iPad, and iPod touch - Apple Support
    http://support.apple.com/en-us/TS4215
    Cheers,
    Matt M.

  • REFInd stuck but works using UEFI Shell v1 (but not v2) [FIXED]

    Hi,
    First ArchLinux install and it gets problematic. I've followed the Beginner's guide and am now in the following situation.
    rEFInd get stuck on:
    rEFInd - Booting OS
    Starting vmlinuz-arch.efi
    Using load options 'root=/dev/sda5 ro rootfstype=ext4 add_efi_memmap initrd=\EFI\arch\initramfs-arch.img'
    The \EFI\arch\refind_linux.conf contains the following line:
    "Boot" "root=/dev/sda5 ro rootfstype=ext4 add_efi_memmap initrd=\EFI\arch\initramfs-arch.img"
    Interestingly, when I start it from the UEFI shell (from the arch installation cd) it works with the v1 but not the v2 !?
    What did I overlook?
    edit: initrt was a typo… sorry.
    Last edited by greut (2013-03-27 18:10:53)

    greut wrote:
    srs5694 wrote:Second, try simplifying your command line. The "rootfstype=ext4 add_efi_memmap" options are probably unnecessary, so removing them (at least for testing) is desirable.
    Yep, I can boot using only:
    vmlinuz-arch.efi root=/dev/sda5 ro initrd=\EFI\arch\initramfs-arch.img
    But still, it works with the UEFI Shell v1 from the liveUSB but not using the shell v2 or via rEFInd directly.
    Is there any particular reason you need those options? If not, just leave them out and call it fixed. If you care to do more investigation, though, I'd be interested in knowing which of those two options is causing problems -- or perhaps if only the combination of both of them is causing problems. If either alone works but not both, then I'm inclined to suspect there's a problem with the length of the options line, although that seems odd, since I'm pretty sure I've tested with long options lines in the past with no sign of trouble.
    I also can't help but wonder if this might somehow be related to the problem being discussed in this thread, which also has a bug report here. That seems to be a problem with specific kernels, but it's conceivable that there's an interaction between kernels and some other unknown factor.
    FWIW, I just did a quick scan of the most relevant section of the rEFInd code and I didn't spot anything suspicious about how it's handling those strings. In fact, it's using allocated memory rather than fixed character arrays, so a hard limit caused by a string of length x seems to be unlikely as a cause unless it were in the kernel's EFI stub loader -- and then you wouldn't see the difference based on the boot manager type (EFI shell v.1 vs. EFI shell v.2 vs. rEFInd).

  • Websites will convert to a PDF using Adobe Acrobat 9 but not Adobe Acrobat XI

    Hello,
    We have noticed that there are several websites that can be concerted into a PDF using Adoble Acrobat 9, but do not work with Adobe Acrobat XI. An example is the website http://amseventsubc.com/. This site converts with no problems using Adobe Acrobat 9, but will not work with Adobe Acrobat XI. When one tries to convert the website (by going Create > PDF from Web Page > Capture Multiple Levels > Get entire site > Create) it starts to work for about 10 minutes but then stops and crashes the program.
    Does anyone have a suggestion for how to fix this problem?
    Is there any reason why a website would work in an older version of Acrobat and not the most recent?
    Thanks for your help!

    Hi, we are actually not looking to have active links but rather to have the content from each link saved as part of the PDF (We are looking to convert the entire website's content to PDF). On Adobe X you can normally append any link so that its content will be converted and added to your PDF, however, this can't be done with XML links. 

  • TS3276 Anyone experiencing problems sending mail using TalkTalk - can receive but not send  - was ok up until pm 24/08/12 - have recently loaded Mountain Lion patch could this be the problem?

    Anyone experiencing problems sending mail using Apple Mail viaTalkTalk - can receive but not send  - was ok up until pm 24/08/12 - have recently loaded Mountain Lion patch could this be the problem?

    jag157 wrote:
    "I managed to solve the problem. Under smtp settings (mail preferences/accounts/edit smtp) I set the outgoing port to 25 (as recommended by Talktalk), no authentication (set to none) and unchecked SSL. I found that until I set the port to 25 and authentication to none I was unable to uncheck SSL. One I had done this I was able to send from my main email and other email adddresses set up under my account."
    Superb advice R&W!  My email sending block using TalkTalk started 2 months ago using Snow Leopard, continued when I upgraded to 10.8.2, and has been persistent on my wife's new iPad (IOS 6.1).  Implementing your wise words has fixed all that, and now enables me to call her on FaceTime — previously only she could call me.  Thank you so much; this will save hours of further fruitless searching and phoning.
    Please remember that your email is now insecure, if you wish to have a secure connection SSL must be on and port 25 should be avoided.

  • Data plan used if MiFi connected but not actively being used?

    If computer is on overnight but not in use, meaning MiFi connected, with that use up my data plan? Or does it use up with "active" use only? I'm sharing internet with other people so I'm not sure my data plan is being used on purpose or just getting eaten up while we are all asleep? I'm already maxed with 3 weeks to go!!!

    As long as you have devices connected to the MiFi there is always a risk that those devices will consume data behind the scenes without your knowledge.  This is how network connected devices work, they are constantly "in use" while connected.  Computers, smart phones and any kind of internet connected devices are constantly backing up content, looking for updates and talking to other network devices.  It has nothing to do with your active participation and all internet communication is held against you on your data plan.
    The only way to completely stop data usage is to turn off your MiFi when it is not needed.  This is a common safe practice that you should start using when on a metered data plan.  MiFis are not intended to be left on 24x7 anyways, frequent reboots will help ensure the device stays in proper working order and increase the longevity of its life.
    Verizon does provide everyone with a data log.  The data log will provide you with time stamps and the amounts that are consumed at those times.  It should be easy to see when your biggest spikes of consumption are.  Isolate what devices are online during those times and what may have been going on and you can start to build a picture of where the problem lies.
    To truly see the network traffic in terms of specific applications, web services or devices you need to find and install network monitors.  Network monitors come in a variety of applications so you need to find and build a monitoring system that fits your environment.  Considering you have other people connected to your MiFi it would not be uncommon for each of you to install a separate monitor specific to those machines.
    Let me know if you have any other questions.

  • Can login to OS 10.4.9 server using 10.4 client, but not with 10.3.9 client

    When I try to login to OS 10.4.9 server using 10.4 client, all is fine, but not with 10.3.9 client -- what's up?
    It seems that when I set the group preferences (what kind of dock the users in our elementary school see, etc.), it doesn't affect 10.4 clients, but when trying to log onto the server using a 10.3.9 client, it just runs and runs, never logging on. Have to eventually restart the client computer. If I take a user out of a group with preferences set, it's fine. So, help! Most of my computers in my lab are 10.3.9. All are bound.
    Thanks,
    Joan

    Hi Devils_Coup,
    first of all: WELCOME TO THE DISCUSSIONS!
    It is strongly recommended to use OS 9.1 or higher. However, you do not have to buy it, just download and apply the free updates here: Mac OS 9: Available Updates.
    Also make sure your firmware is up-to-date: Firmware Upgrades.
    In MacOS X remember: Repair permissions before and after an update!
    If this answered your question please consider granting some stars: Why reward points?

  • I can no longer login to receive my webmail with a second email address; i have already cleared my "saved passwords" and cleared my history, and still i can only login using one email address but not my second one, which i previously was able to do

    details are listed in the question; i login using one email address to this site but not my second, which i have always been able to do
    The error message is:
    Login failed because your username or password was entered incorrectly.
    However, all my login information is correct.

    try the hints found at
    http://support.apple.com/kb/TS1417

  • Using iWeb ftp trouble but not with Fetch

    I have a site I created with iWeb and I cannot get it to publish to the ftp server (3essentials). I currently publish the site to a local folder, then upload the site folder using fetch. I would like to do it all through iWeb. But I keep getting an error? Any ideas on why it work for fetch and not iWeb?
    thanks for any ideas.

    Thanks for the tip. I tried it, and I had more success but not complete ...it now goes along farther without quitting,but says my password is incorrect. Which doesn't make sense because it is the same password that works for Fetch.
    any ideas?
    thanks,

Maybe you are looking for