Strange behavior with MIN MAX at the same time.

Hi all

I had a large table of 5100 K records. I created a Unique Index on a column:

CREATE UNIQUE INDEX TRANS_ID_IDX on TRANS (TRANS_ID);

When I asked the Table with this these two applications:

Select min (trans_id) in trans;
Select max (trans_id) in trans;

The execution Plan shows INDEX FULL SCAN (MIN/MAX) and the performance is really quickly (0.01 sec) because the optimizer chooses get the value of the index, of course.

But now, if I ask the table with two operators:

Select max (trans_id), min (trans_id) in trans;

I got:

TABLE ACCESS FULL and indeed it's really slow to get my answer (9 seconds).

Even if they are shown a suspicion in my request, it does not:

Select / * + INDEX (TRANS TRANS_ID_IDX) * / max (trans_id), minutes (trans_id) from trans; == > always TABLE FULL ACCESS!

So why the optimizer does not use INDEX FULL SCAN (MIN/MAX) to the query when the min and max are both both in the query?

My database is 11.1.0.7 (with the last batch of patches) on Win XP

Concerning

SomeoneElse says:
... My order_line_detail table has about 42 M lines. order_line_detail_id is the primary key.
..

Primary key does the trick here, or even NOT NULL column definition.

SQL> drop table dingostar;

Table dropped.

SQL> create table dingostar (id number);

Table created.

SQL> insert into dingostar select rownum as id from dual connect by level <= 5000;

5000 rows created.

SQL> create index dingostar_idx on dingostar(id);

Index created.

SQL> explain plan for
  2  select max(id),min(id) from dingostar;

Explained.

SQL> select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
---------------------------------------------------------------------------------------
Plan hash value: 1182922403

--------------------------------------------------------------------------------
| Id  | Operation          | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |           |     1 |    13 |     5   (0)| 00:00:01 |
|   1 |  SORT AGGREGATE    |           |     1 |    13 |            |          |
|   2 |   TABLE ACCESS FULL| DINGOSTAR |  5000 | 65000 |     5   (0)| 00:00:01 |
--------------------------------------------------------------------------------

Note
-----
   - dynamic sampling used for this statement

13 rows selected.

SQL>
SQL> drop table dingostar;

Table dropped.

SQL> create table dingostar (id number primary key);

Table created.

SQL> create index dingostar_idx on dingostar(id);
create index dingostar_idx on dingostar(id)
                                        *
ERROR at line 1:
ORA-01408: such column list already indexed

SQL> insert into dingostar select rownum as id from dual connect by level <= 5000;

5000 rows created.

SQL> explain plan for
  2  select max(id),min(id) from dingostar;

Explained.

SQL> select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
---------------------------------------------------------------------------------------
Plan hash value: 528434344

-------------------------------------------------------------------------------------
| Id  | Operation             | Name        | Rows  | Bytes | Cost (%CPU)| Time     |
-------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT      |             |     1 |    13 |     5   (0)| 00:00:01 |
|   1 |  SORT AGGREGATE       |             |     1 |    13 |            |          |
|   2 |   INDEX FAST FULL SCAN| SYS_C007051 |  5000 | 65000 |     5   (0)| 00:00:01 |
-------------------------------------------------------------------------------------

Note
-----
   - dynamic sampling used for this statement

13 rows selected.

SQL>
SQL> drop table dingostar;

Table dropped.

SQL> create table dingostar (id number not null);

Table created.

SQL> create index dingostar_idx on dingostar(id);

Index created.

SQL> insert into dingostar select rownum as id from dual connect by level <= 5000;

5000 rows created.

SQL> explain plan for
  2  select max(id),min(id) from dingostar;

Explained.

SQL> select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
---------------------------------------------------------------------------------------
Plan hash value: 2124830711

---------------------------------------------------------------------------------------
| Id  | Operation             | Name          | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT      |               |     1 |    13 |     5   (0)| 00:00:01 |
|   1 |  SORT AGGREGATE       |               |     1 |    13 |            |          |
|   2 |   INDEX FAST FULL SCAN| DINGOSTAR_IDX |  5000 | 65000 |     5   (0)| 00:00:01 |
---------------------------------------------------------------------------------------

Note
-----
   - dynamic sampling used for this statement

13 rows selected.

SQL>

Nicolas.

Tags: Database

Similar Questions

  • Pair blackBerry smartphones my BB8330 with multiple devices at the same time?

    matching my BB8330 with my blue tooth earphone(TM:jawbone) and my microsoft sync which is at the same time in my car? If I combine the car, will I need to pair my jaw all over again?

    TeslasBB wrote:
    matching my BB8330 with my blue tooth earphone(TM:jawbone) and my microsoft sync which is at the same time in my car? If I combine the car, will I need to pair my jaw all over again?

    You can only pair one device at a time to your 8330, or any other phone besides.  The "pairs" are saved in the phone, you can use one or the other and you will not have to pair it again.  Once you turn on your bluetooth device and the phone is turned on, they will find each other again.

    Hope this helps,

  • Bluetooth connection with two devices at the same time? (on TX)

    I have a Palm TX and am trying to connect to the Palm Bluetooth keyboard wireless AND my cell phone of Nokia (Internet, etc.) at the same time.  The TX works very well with each device individually.  However, when I try to use them together, it won't work.  If I connect the keyboard first, then try to connect to the phone for internet access, it automatically CUTS the keyboard; and vice versa - any order of connection, it will cut the previous when it is connected.  (If the keyboard is connected and I use a fast connection button to go directly to the internet, when he tries to connect it will say that the port/cable is bad and can not connect.)

    (I know generally that a bluetooth device can support up to 7 other devices in its network and I've read where people supposed to logged keyboards and phones to the TX before I bought the keyboard).

    Any help is appreciated!

    fitnessdr wrote:

    Thank you for the information.  So if I had to return the new bluetooth keyboard, should I get the 'Palm 3169WWZ Wireless Keyboard", or y at - it another model I should look for?  (From what I can tell, I think he will use IR)

    Thank you!

    Well, that's the one I use.

    Don't forget to download the driver for the more recent (1.13) for the keyboard in the Palm Support pages for the keyboard:

    http://KB.Palm.com/wps/portal/KB/na/keyboards/palmuniversalwirelesskeyboard/unlocked/downloads/page_en.html

    Do not install the driver provided with the device on the disc - 1.13 is designed for the TX and fixes a bug that existed in the original pilot.

    WyreNut

  • Is it possible to predict with different planners at the same time in the schedule of adobe story?

    Hello

    I produce a daily paper in Belgium and I am looking for a powerful script writing/planning tool produce a daily soap opera. Shoot us 2, sometimes 3 series at the same time and have 7! Planners working on our schedule. I need a tool that:

    -communicates with the final version of the project (or otherwise: has a good script tool in the writing system)

    -allows planners to several at the same time to work in the same document on the web. With the ability to block certain parts of planning for others, give rights...

    -a a good agenda to track the availability of the distribution

    Hi Reinhout N,.

    Adobe Story more would allow you to do this. All employees must be members creative cloud, however.

    Thank you

    Kevin

  • Can I upgrade my membership for use with 4 computers at the same time?

    I have an Adobe membership and I use it very well on my computer

    Now, more people are joining in and I think to upgrade my membership to use it on 4 computers at the same time.

    Kindly advice if this is possible and how to do it.

    Kind regards

    Issam

    Hi Issam

    Each user must have their numbers, so they each need to register using a unique ID for Adobe.

    We also have team members that provides additional storage central license management - https://creative.adobe.com/plans

    Kind regards

    Bev

  • can you use FaceTime with three devices at the same time.

    I need to be able to have a video conference with three people. A person will demonstrate a product whose other two will check to see that it is OK. Each person is in a different location. I can't find anywhere how to do this. Since it is an event of the time, I won't buy any conference high-end software. We will have a combination of iPhones and iPads.

    N ° but Skype should work.

  • HP-S5-1414: use two onboard video with add on video PCIe at the same time

    I have a HP S5-1414 (HP Pavilion Slimline). It has 2 DVI connectors on board and a PCIe x 16 slot with a Gigabyte R9 270 X Video card. With a lot of motherboards with onboard video you can now launch the edge and a discrete video card simultaneously. I tried to do this on this system without success. The question is this. Is there a way use Board on board with separate video, at the same time?

    Jim Hutto
    I do not work for HP.
    I am a computer technician and a passion for computing with more than 32 years of computer repair and networking experience

    Hello

    Space cleary wrote:

    Integrated Intel Graphics Media Accelerator HD graphics
    * Built-in video is not available if you have installed a graphics card or an Intel processor ending with 'P'.

  • 2 phidgets at the same time, the event problem

    Hello

    Currently I do a Vibration Analyzer to measure the communicability between 2 masses, so I need to measure the two masses at the same time with 2 phidgets at the same time. My problem is, when I use only phidget both the program identifies correctly and it measures very well, I use 2 different phidgets, the 1056 and the 1049. But when I plug them both at the same time only an event is on, he identifies the two but the graphs do not work properly for some reason, and I think that its because of the event. I'm not very good at Labview, I only did a simple program before, so my experience is not very large. I hope that he didn't need a Subvi.

    Would be grateful for the help from you guys.

    Best regards.

    João Pereira


  • Opening at the same time both submenus

    I'm creating an application interface user who have about 10 different menus. Now I need when the user then works with a submenu at the same time, it can open the submenu other belong to the other menu.

    When I was setting up the structure of the event, then I disabled the setting lock front panel but now I am only able to select the menu but not able to open any window, and as soon as the active window then closes automatically activated window opens previously...

    Thank you


  • I am a customer of Qwest and they changed all my "Hotmail" email and I do not. How can I go back to msn mail. At the same time, I would also uninstall instant messenger.

    I am a customer of the West and they changed my "Hotmail" email  I like the way he was with msn.  At the same time, I also want to disable or uninstall Instant Messaging on my computer.  I'm "Dell Dimension 2400 Series with windows XP"

    Hi ARMELDEDEHOUANOU,
     
    -Are you talking to disabling Windows Live Messenger?
     
    Your email account cannot be changed by Qwest. MSN e-mail account is the same as the Hotmail account.
     
    If you have problems with Hotmail, post your request in the Forums of Hotmail for assistance on this issue.
     
    If you are referring to Windows Live Messenger, follow the steps in the link below to uninstall the same.
  • Is possible to set a user by default POV to all users at the same time?

    Hello world...

    I develop a report with the financial report and I want to set a default value for a dimension in the POV for all users. Because when I set a POV on my report it apply only to the user that I use for preparing the report. Other users connect to this report, it sets a default value of values other than the values that I have set myself. I tried to use a form of POV. It applies to the POV, I'm set for all users, but I am able to work with a grid at the same time.

    PS: Sorry if I wasn't clear enough!

    Kind regards
    Rafael Melo - Brazil

    Hi Rafael

    The ManageUserPov.properties will only fix the POV for one or more users at a specific point in time. As soon as a user opens a report and changes of this POV, then it is lost.

    I know what you're trying to do, but I don't think that there is a way to apply the kind of logic that you hope.

    There is a way of (or certainly used to be a way of) hardcode the POV in the report URL. I am sure that this worked when prior workspace Hyperion financial reports used to have its own web client. It's thinking is the basis of the road that linked the statement of work, that's why I suggested that you look at. You could try to find a way to open the report by substituting the POV by using this hard-coding in the URL or go with my original plan of hard coding a "landing page" type report with your default POV and then use reports related to take the user following a report in which they can change the POV as they wish.

    Hope this helps
    Stuart

  • detection cameras two PB GigE with MAX on the same pc

    I installed on the same GigE camera for two PCs, each device has its own interface card (IP), but only a camera in dtected with max.
    cam0 sometimes and sometimes cam1. I have to wear each camera fixed an IP address, but still only the camera is detected.
     
    My question is how to do the configuration to appear the two camera at the same time with max.
    I use the version of MAX 5.3
    NEITHER IMAQDX 4.0
    You think even match for your help.

    Are you running Windows XP? If, therefore, due to limitations in the underlying OS stack, you will need to place the cameras in different subnets or to fill the two devices together in one virtual device (preferably) NIC.

    Eric

  • Question about running from two cameras at the same time with MAX

    Hello

    I have two cameras attached to NI PCIe-1430 frame grabber card (Atmel Aviiva M2 CL and Fairchild 2 K LS) IRLS. It's ok when I run two cameras individually, but I can't run them at the same time.

    This is the step that simultaneously run two device:

    1. open MAX, select the port and start image acquisition by pressing the 'Grab' button, I can see the image at this point.

    2. open another MAX session, select the other port and press "enter". I got following error:

    "Error 0xBFF60021".

    Unable to perform request; acquisition in progress'

    Sometimes, I got this error too:

    "Error 0xBFF60022".

    A timeout error occurred while you wait for the specified event. If you expect a picture, check the video data is acquired in the period. If in the meantime the signal, check that the assertion of signal has occurred within the period. »

    I already give enough timeout Fame to the tab settings of Acquisition.

    The MAX version used is 4.5.

    You have an idea on that? Makes simultaneous Imaging MAX support?

    Thank you

    -polarfox

    Thanks for the quick response Bruce.

  • Sourcing rule works with min - max?

    Hello

    (1) Will Sourcing rule works with min - max planning? How?

    (2) and how you decide who use elements of planning elements u and wich Min - max, to the point of replenishment of development?

    Published by: 832641 on February 4, 2011 19:35

    (1) Yes, sourcing will work in the same way that it works with other sources such as kanban, etc. of the PSO. You must define the ASL for the rule point and sourcing with the corresponding transfer game.

    (2) according to my understanding logically point re - order is nothing but Min - Max, min, and max equal to Min value of the stock you want to maintain for the item

  • strange behavior with script times

    Hi all

    I have strange behavior with one of my scripts, and I can't understand where is the problem.

    Before you post the code, here's the principle.

    My form has two fields of time: "Time of Injection" and "Post injection time.

    The script runs when the output of "injection time" event and look if the injection time is before time "post injection.

    Here is my code:

    //get the value of the field "Injection time"
    var injection = this.formattedValue;
    
    //create an new Date object
    var injectionTime = new Date();
    
    //split the string to get the HH MM and SS values of the formattedValue (HH:MM:SS)
    var injectionTimeHoursString = injection.substr(0,2);
    var injectionTimeMinutesString = injection.substr(3,2);
    var injectionTimeSecondsString = injection.substr(6,2);
    
    //parse the strings into integer
    var injectionTimeHoursInt = parseInt(injectionTimeHoursString);
    var injectionTimeMinutesInt = parseInt(injectionTimeMinutesString);
    var injectionTimeSecondsInt = parseInt(injectionTimeSecondsString);
    
    //set the integer values into my Date object
    injectionTime.setHours(injectionTimeHoursInt, injectionTimeMinutesInt, injectionTimeSecondsInt,0);
    
    
    //do the same for the other time field "Post injection time"
    var post = post_injection.post_time.formattedValue;
    var postTime = new Date();
    var postTimeHoursString = post.substr(0,2);
    var postTimeMinutesString = post.substr(3,2);
    var postTimeSecondsString = post.substr(6,2);
    var postTimeHoursInt = parseInt(postTimeHoursString);
    var postTimeMinutesInt = parseInt(postTimeMinutesString);
    var postTimeSecondsInt = parseInt(postTimeSecondsString);
    postTime.setHours(postTimeHoursInt, postTimeMinutesInt, postTimeSecondsInt,0);
    
    
    //calculate the difference between both
    var diff = postTime.getTime() - injectionTime.getTime();
    
    //if the difference gives a negative result, display a message, empty the fields and set focus
    if(diff<0) {
         xfa.host.messageBox("The time of injection should be sooner than the time of post-injection activity measure.\n\nPlease re-enter correct times.","Incompatibility of times");
         this.rawValue = "";
         post_injection.post_time.rawValue = "";
         xfa.host.setFocus(post_injection.post_time);
    }
    

    The code seems to run pretty well... except with certain values.

    If postTime is 12:00

    and injetion is 12:04

    I get the error message and everything, so it's OK

    BUT

    When postTime is 12:00

    and injectionTime is 12:08

    No message! as if the difference was not negative! (the difference is zero...)

    When I display the time in a messagebox, 12:04 12:04:00 GMT blah blah... gives but 12:08 gives 12:00:00 GMT etc...

    same problem with 12:09, but not 12:10 for example...

    Any thoughts?

    Thank you.

    Thank you, but since I'm used to javascript, I'll stick to it.

    I understand the problem. It's a javascript with the ParseInt method bug!

    Check here: http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256C85006A6604

    parseInt("08") = 0.

    How to lose 2 hours for a stupid bug...

Maybe you are looking for