The index used only when given Index indicator

Hello

Version of RDBMS - 11.2.0.3.0

I have a situation where only when I use the Index indicator, index does is used.

Use case: -.

1. SELECT query on a table with about 100 KB of data.

2. have the index on the column that is used in the WHERE clause of the SELECT query.

CREATE TABLE him_entity (id NUMBER, him_val CHAR(1));


INSERT INTO him_entity
SELECT rownum,'1' FROM dual CONNECT BY level<=1000000;


CREATE INDEX idx_him_val ON him_entity(him_val);





Without using Index indicator, Explain plan: -.

SELECT ID 
FROM him_entity
WHERE him_val='1';


-----------------------------------------------------------------------------------
| Id  | Operation         | Name          | Rows  | Bytes | Cost (%CPU)| Time     |
-----------------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |               |  1000K|  4882K|   498   (5)| 00:00:06 |
|*  1 |  TABLE ACCESS FULL| HIM_ENTITY    |  1000K|  4882K|   498   (5)| 00:00:06 |
-----------------------------------------------------------------------------------


Predicate Information (identified by operation id):
---------------------------------------------------


   1 - filter("HIM_VAL"='1')

With the help of Index indicator, explain the plan: -.

SELECT /*+ index(him_entity idx_him_val)*/ ID 
FROM him_entity
WHERE him_val='1';


---------------------------------------------------------------------------------------------
| Id  | Operation                   | Name          | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |               |  1000K|  4882K|  3485   (1)| 00:00:42 |
|   1 |  TABLE ACCESS BY INDEX ROWID| HIM_ENTITY    |  1000K|  4882K|  3485   (1)| 00:00:42 |
|*  2 |   INDEX RANGE SCAN          | IDX_HIM_VAL   |  1000K|       |  1824   (1)| 00:00:22 |
---------------------------------------------------------------------------------------------


Predicate Information (identified by operation id):
---------------------------------------------------


   2 - access("HIM_VAL"='1')

(1) could you explain why Index was not be picked up without indicator Index for help?

(2) I gathered statistics for the table before running the query.

(3) is it fine / safe to use the FIRST_ROWS hint instead of Index indicator?

Thank you...

  1. SELECT THE ID
  2. OF him_entity
  3. WHERE him_val = '1';

You select all the rows in the table.

As your query will extract all lines then the optimal trajectory IS FULL TABLE SCAN instead of using INDEXES

If we let you use less than 5% of table rows, and then using index can be an optimal trajectory to go for the record.

  1. SELECT / * + index (him_entity idx_him_val) * / ID
  2. OF him_entity
  3. WHERE him_val = '1';

Your strength of indicator Index to fetch the file by using the index of the query

Tags: Database

Similar Questions

  • Somehow I can get the length of a segment of the timeline using only entry points and somehow like in FCP?

    Users of Adobe Premiere:

    Somehow I can get the length of a segment of the timeline using only entry points and somehow like in FCP?


    I want to get the exact length of timecode for some segments only, not the entire timeline. Can not know how to do this.

    If you set the entry points and in the program monitor, is indicated to the right:

  • the 500 limit applies to all the forms, or only when extended rights are applied?

    I am trying to determine if the '500' on the responses by pdf limit to any PDF, or only those whose extende rights apply?

    The limit applies only when you use Acrobat 11 or before applying usage rights and distribute it to the more than 500 active users. Acrobat DC has no license restrictions.

  • HP Color Laserjet M277n MFP: How to use the black cartridges only when the color toners are empty

    Hello team HP,

    I recently bought a HP Color Laserjet MFP M277n I printer I print black & white user only and really don't need color prints. How to set the printer options to print only black & white? How can I replace only the black cartridge when the color cartridges are empty? How many prints (approximate), we can take by toner?

    Kind regards

    Christèle

    Hi @Pavumba,

    Welcome to the Forums of HP Support!

    I understand you're wondering how to use black ink only on your HP Color Laserjet M277n MFP printer. I would be glad to help and don't forget to come back to this thread and check "Accept as Solution", if I have successfully helped solve you the problem. If you want to say 'Thank you' to my effort to help, click on the "thumbs up" to give me a Kudos.

    I see that you wonder if you need to replace the color cartridge when it is low. This printer is a printer AIO, therefore, you need to replace the ink cartridge when it becomes too weak to be able to resume printing. However, if you print mostly in black, you can configure a preset black only to print in black and white. This would help reduce the use of the color cartridges.

    NOTE: Composite black - for black and white images and photos, a mix of colors called 'composite black' can be used to achieve the quality significantly improved picture and soft gray tones that can be achieved with only black toner. For users who want to print images using just black toner, many HP printers color customer offer configurable options allowing the client to print using only black toner. For example, by selecting "print in grayscale" in the printer driver Specifies print using black ink only. For more information about the use of the toner cartridges, please see this article: how the Toner is used.

     
  • HP 4500 All In One Envy... Print from the cartridge color only when black ink is low...

    Is it possible to print with the cartridge color only if the black cartridge is low or outside? I have the HP Envy 4500 e All in One... What can I do?

    Hello

    You can use the color ink only by removing the small black cartridge.

    You can find the next steps in his guide of the user as a reference:

    Use single-cartridge
    Use single-cartridge use the HP ENVY 4500 series with only one cartridge. The
    mode Single-cartridge begins when an ink cartridge is removed from the distribution of ink cartridges.

    on the printer screen.

    Shlomi

  • Display the field calculated only when there is data

    Hello

    Is there a way to display my value only when the data entry field is used. For example, if I have several fields aligned vertically, I don't want to display a bunch of zeros if their data fields are not used.

    Thank you!!!

    You must write the script in the event of Field2 Calculate.

    The value of the FormCalclanguage.

    if(numPeople.RawValue ne null) then

    numPeople * 12

    endif

    My previous answer shows 2 ways to write the same script. A FormCalc and other JavaScript...

    Thank you

    Srini

  • Pages on the Web site only when downloaded to file manager

    Hello!


    I am re-doing a Web site and I'm downloading new content. I deleted the index on the FTP Server page and replaced by a new page in the index and the images to go with it. When I go online to the field, the home page appears quickly - very well! -except that three of the four images are missing. I tried to remove the image of the files on the FTP and download them once again, but always without success. No idea what I did wrong?


    The second problem is that while the index page works, the links are active etc., pages that are blank. No error message or anything presents, and load the pages as if they were meant to be a Virgin. I built the Adobe Dreamweaver site, and when you open my computer pages in Dreamweaver they are full of code and look good. I tried searching google and Adobe Help topics for advice, but nothing seems to describe the symptoms of right! You have any suggestions to make changes I need to make sure that the site works properly?


    I don't know if these two problems are related. I tried one of the pages virgins relabelling as the index page, but it still load blank, so I think that the fault is with the page and no links to it. The domain is www.charlotte-stockdale.co.uk, if that helps.


    Thanks in advance!


    I don't know what the problem is, but it looks like a misconfigured web server. For example, if you browse the http://www.charlotte-stockdale.co.uk/side_frame.jpg it returns the text of the url. I have never seen it before. I could contact your host and see if they can check the server config.

  • return the empty record only when no results not returned by the main query

    It is a question of SQL (not PL/SQL)...

    Let's say I have the following text:

    Full_name SELECT NULL, NULL, NULL last_update_date address
    OF the double
    UNION ALL
    SELECT full_name, address, last_update_date
    Employees
    WHEN TRUNC (sysdate) = TRUNC (last_update_date)

    If the second part of the query retrieves no rows, it works beautifully and I get a blank line; However, if the second part of the query returns records, I get a blank line over my dataset I want.

    How can I create a SQL statement that executes only the first query (before the union all) when no result is returned from the second. Also, I don't want to exceute the query twice only if I can get a count of the records because my actual query is much more complex than the example I've provided here.

    Thanks in advance!
    Emily

    Hello

    You can try to use a subquery factoring (WITH clause)
    The query is executed only once, the query results are cached in memory or in a temporary table.
    and you can view these results several times in the main query:

    WITH second_query AS (
      -- your second query here
      SELECT full_name, address, last_update_date
      FROM employees
      WHERE TRUNC(sysdate)=TRUNC(last_update_date)
    )
    SELECT full_name, address, last_update_date
    FROM second_query
    UNION ALL
    SELECT NULL full_name, NULL address, NULL last_update_date
    FROM dual
    WHERE NOT EXISTS ( SELECT 1 FROM second_query)
    

    Published by: kordirko on 2010-07-08 02:02

  • How to integrate an audio to a Muse image file so that the music plays only when you click on the image?

    Hello! I'm looking for a way to incorporate an audio file (mp3 or quicktime) into a still image in my Muse site. Ideally, the audio would play only when you click the image, so that each image can contain a separate audio file. So important is that the audio file is not visible on the site (so soundcloud, youtube and vimeo doesn't work here). Is there a way to do this? Thank you, AR

    Check out this edition of the month of 123Muse (www.123Muse.com). This is audio and video by Muse.

  • Displaying the time in the Date fields only when it is available

    Is it possible to display the component "hour" of a field of date only when the component "hour" is available? I know that the default behavior of not showing the component "hour" of the date fields can be changed by setting the date format NLS in the preferences to include the time as well. However, what causes the fields without component to appear with zeros. (For example: If nls date format is DD-MON-RRRR HH24:MI:SS, a date with no field component "time" will appear as * 1 January 2008 00:00:00 *). It is a configurable option in Quest SQL Navigator, with 3 options available, that says "(afficher l'heure dans les champs date: a) (never, (b) when available or c) always, who miss me dearly in SQL Developer."

    Thanks in advance for your suggestions,
    KLS.

    No, but you can vote on the feature to http://htmldb.oracle.com/pls/otn/f?p=42626:39:4403831115154402:NO:P39_ID:16221 request to add weight to implementations in a future version.

    Kind regards
    K.

  • Task Scheduler error 2147944309 when I change the task ' Run only when the user connects ' to 'use execute is connected or not' _

    I have a simple task (cmd batch file). Whenever I try to change the settings, I get a dialog box that reads as follows:

    "An error has occurred for task RemoteBk. Error message: the following error is reported: 2147944309 ".

    My computer is on a domain.

    Someone in another forum explained the error:

    0n2147944309 = 0 x 80070775

    Installation: 8007 = Win32 (it's a status code "Win32")

    Status: 0 x 775 = 0n1909

    Q:\>net helpmsg 1909
    The referenced account is currently locked and cannot be logged on to.

    Hope, it may be useful to others.

  • Equium M50 connect to the WLan router only when security is disabled

    MY Equium M50 will connect to my ROUTER BELKIN g only MIMO when security is disabled.

    What is the reason for this please?

    Blonde bimbo!

    Hello

    Did you mean WiFi encryption that blocks the entrance to the local wireless network?
    I suppose that you have set the encryption (WPA, WEP, etc...) on your router WLan but didn't configure the wireless network adapter.

    Well, in my opinion, you should check out what WLan encryption makes the card holder and then choose it on the WLan router. The encryption key must be set to the router and the laptop!

  • Is there a way to put a button on the front panel only when clicked gives a pop-up dialog box with more information on it?

    Hello world

    The simulations that I create are very simple themselves but are intended to use in the classroom to help students learn more about the proven theory.  I hope to be able to place a 'help' or 'other info' button on the front panel that rises wants more info on theory, they can click on it and a pop up appears with background information on it.  It should also have a second button to close it and return to the main façade.  Can anyone lead me in the right direction?

    Thank you!

    Use a structure of the event on the main vi when the button is clicked, launches a "help" void / vi. On the inside of the Sub vi (with the set properties to load the front when it is called, of course), use another structure of the event to wait until then click on the button of the Subvi, you can return to the main VI. Do you need assistance on using the structures of the event?

    Charles

  • Desktop connects to the local wifi only, when the netbook to connect to internet

    Hello. My netbook and phone connect to wireless internet, no problem with my wifi network. And until recently my desktop computer connected ok too, using a usb adapter. However, I now have a problem. my pc connects to the wireless network, but only locally. Can anyone help please? There must be a setting that I or someone has changed?

    Hello

    You did changes to the computer before the show?

    Method 1: I suggest you temporarily disable the antivirus software or firewall and check if it helps:

    Disable the anti-virus software

    http://Windows.Microsoft.com/en-us/Windows-Vista/disable-antivirus-software

    Enable or disable Windows Firewall

    http://Windows.Microsoft.com/en-us/Windows-Vista/turn-Windows-Firewall-on-or-off

    Warning: turn off Windows Firewall/antivirus can make your computer (and your network, if you have one) more vulnerable to damage caused by worms or hackers.

    Method 2: reset the default router and check if this solves the problem:

    Next to the electric power plug, there is a pinhole reset button. Remove all the cables from your router except the power cord. Press reset button with a PIN for 10 seconds. Wait 10 seconds then unplug the router. Router will be at default values, reinstall using the software that came with the router. You may need to reinstall the software of NIC as well. Then write your password on a piece of tape and stick it to your router.

    Method 3: Try the steps in the link and see if it helps:

    Network connection problems

    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-network-connection-problems

    Reference: Wired and wireless in Windows network connection problems

    http://Windows.Microsoft.com/en-us/Windows/help/wired-and-wireless-network-connection-problems-in-Windows

    Method 4: Try the steps from the link and see if it makes a difference:

    Of network connectivity status incorrectly as 'Local' only on a Windows Server 2008 or Windows Vista-based computer that has multiple network cards

    http://support.Microsoft.com/kb/947041

  • How can we make the Partition on the result using only sql?

    Hello

    How to make the partition on sql result using the query.

    sample
    BPREF_NO     BILL_MONTt AVG_IND     partition
    Q12345     1/31/2009     2     part1
    Q12345     2/28/2009     2     part1
    Q12345     3/31/2009     2     part1
    Q12345     4/30/2009     2     part1
    Q12345     5/31/2009     2     part1
    Q12345     6/30/2009     1     part1
    Q12345     7/31/2009     2     part1
    Q12345     9/30/2009     1     part2
    Q12345     10/31/2009     2     part2
    Q12345     11/30/2009     2     part2
    Q12345     1/31/2010     1     part3
    Q12345     2/28/2010     2     part3
    Q12345     3/31/2010     2     part3
    Q12345     11/30/2011     2     part4
    Q12345     2/29/2012     2     part5
    Q12345     3/31/2012     2     part5
    Q12345     4/30/2012     2     part5
    Q12345     5/31/2012     2     part5
    Q12345     7/31/2012     2     part6
    I want to create the partition column using the query
    from the logic below

    If bill_month is the sequence then it must create a partition and if the breaks we need to introduce the new partition.

    just for example...
    January 31, 2009 to July 31, 2009 is called part1
    August 30, 2009 to November 30, 2009 called part2
    like wise...

    is it possible to make the partition of the query itself.

    Please guide me in this regard

    Thanks in advance

    Iqbal
    with testdata as (
    select 'Q12345' BPREF_NO, to_date('1/31/2009','MM/DD/YYYY') BILL_MONTt,2 AVG_IND from dual union all
    select 'Q12345', to_date('2/28/2009','MM/DD/YYYY'),2 from dual union all
    select 'Q12345', to_date('3/31/2009','MM/DD/YYYY'),2 from dual union all
    select 'Q12345', to_date('4/30/2009','MM/DD/YYYY'),2 from dual union all
    select 'Q12345', to_date('5/31/2009','MM/DD/YYYY'),2 from dual union all
    select 'Q12345', to_date('6/30/2009','MM/DD/YYYY'),1 from dual union all
    select 'Q12345', to_date('7/31/2009','MM/DD/YYYY'),2 from dual union all
    select 'Q12345', to_date('9/30/2009','MM/DD/YYYY'),1 from dual union all
    select 'Q12345', to_date('10/31/2009','MM/DD/YYYY'),2 from dual union all
    select 'Q12345', to_date('11/30/2009','MM/DD/YYYY'),2 from dual union all
    select 'Q12345', to_date('1/31/2010','MM/DD/YYYY'),1 from dual union all
    select 'Q12345', to_date('2/28/2010','MM/DD/YYYY'),2 from dual union all
    select 'Q12345', to_date('3/31/2010','MM/DD/YYYY'),2 from dual union all
    select 'Q12345', to_date('11/30/2011','MM/DD/YYYY'),2 from dual union all
    select 'Q12345', to_date('2/29/2012','MM/DD/YYYY'),2 from dual union all
    select 'Q12345', to_date('3/31/2012','MM/DD/YYYY'),2 from dual union all
    select 'Q12345', to_date('4/30/2012','MM/DD/YYYY'),2 from dual union all
    select 'Q12345', to_date('5/31/2012','MM/DD/YYYY'),2 from dual union all
    select 'Q12345', to_date('7/31/2012','MM/DD/YYYY'),2 from dual
    )
    
    select
      BPREF_NO
    , AVG_IND
    , BILL_MONTt
    , 'part'||
      sum (partition) over (partition by BPREF_NO order by BILL_MONTt)
      partition
    from (
    select
      BPREF_NO
    , AVG_IND
    , BILL_MONTt
    , case
      when months_between (BILL_MONTt, lag(BILL_MONTt) over (partition by BPREF_NO order by BILL_MONTt)) = 1 then
      0 else 1 end partition
    from testdata
    )
    
    BPREF_NO AVG_IND BILL_MONTT PARTITION
    Q12345 2 01/31/2009 part1
    Q12345 2 02/28/2009 part1
    Q12345 2 03/31/2009 part1
    Q12345 2 04/30/2009 part1
    Q12345 2 05/31/2009 part1
    Q12345 1 06/30/2009 part1
    Q12345 2 07/31/2009 part1
    Q12345 1 09/30/2009 part2
    Q12345 2 10/31/2009 part2
    Q12345 2 11/30/2009 part2
    Q12345 1 01/31/2010 part3
    Q12345 2 02/28/2010 part3
    Q12345 2 03/31/2010 part3
    Q12345 2 11/30/2011 part4
    Q12345 2 02/29/2012 part5
    Q12345 2 03/31/2012 part5
    Q12345 2 04/30/2012 part5
    Q12345 2 05/31/2012 part5
    Q12345 2 07/31/2012 part6 
    

Maybe you are looking for