Oracle 10.2.0.4 Index on the time stamp column not used when SYSTIMESTAMP is used.

Hello
I have a table with a timestamp (6) column B. About 300000 rows in the tables...
I created index 'idx' on column B.

When I compare the column 'B' with systimestamp, it does not use the index, whereas if I compare 'B' with sysdate it uses the index.

For example:
Select count (*) in a b where clause < = sysdate;

The above used the subscript "idx" and executed in 1 second

Select count (*) in a b where clause < = systimestamp;

The foregoing does not use the index and performed in 19 seconds.

Any clue?

Thanks in advance

Oracle uses the internal functions when you use SYSTIMESTAMP:

Work around is to use TO_TIMESTAMP as shown below... Or define a function based index...

You can check the performance querying against a column "TIMESTAMP WITH time ZONE SCHEDULE" issue link too

SQL> create table a(b timestamp(6));

Table created.

SQL> insert into a
  2  select systimestamp+(level/24) from dual connect by level <= 30000;

30000 rows created.

SQL> commit;

Commit complete.

SQL> create index ndx on a(b);

Index created.

SQL> explain plan for
  2  select count(*) from a where b <= sysdate;

Explained.

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

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 3858831102

--------------------------------------------------------------------------
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |      |     1 |    13 |     1   (0)| 00:00:01 |
|   1 |  SORT AGGREGATE   |      |     1 |    13 |            |          |
|*  2 |   INDEX RANGE SCAN| NDX  |     1 |    13 |     1   (0)| 00:00:01 |
--------------------------------------------------------------------------

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

   2 - access("B"<=SYSDATE@!)

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

18 rows selected.

SQL> explain plan for
  2  select count(*) from a where b <= systimestamp;

Explained.

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

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 3918351354

---------------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |     1 |    13 |    20  (15)| 00:00:01 |
|   1 |  SORT AGGREGATE    |      |     1 |    13 |            |          |
|*  2 |   TABLE ACCESS FULL| A    |     1 |    13 |    20  (15)| 00:00:01 |
---------------------------------------------------------------------------

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

   2 - filter(SYS_EXTRACT_UTC(INTERNAL_FUNCTION("B"))<=SYS_EXTRACT_UTC(S
              YSTIMESTAMP(6)))

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

19 rows selected.

--"Just tried using TO_TIMESTAMP"

SQL> explain plan for
  2  select count(*) from a where b <= to_timestamp(systimestamp);

Explained.

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

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 3858831102

--------------------------------------------------------------------------
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |      |     1 |    13 |     2   (0)| 00:00:01 |
|   1 |  SORT AGGREGATE   |      |     1 |    13 |            |          |
|*  2 |   INDEX RANGE SCAN| NDX  |     4 |    52 |     2   (0)| 00:00:01 |
--------------------------------------------------------------------------

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

   2 - access("B"<=TO_TIMESTAMP(TO_CHAR(SYSTIMESTAMP(6))))

14 rows selected.

Published by: JAC on October 23, 2012 11:18

Tags: Database

Similar Questions

  • Find indexes in the schema that are not used

    Hello
    Anyone know an easy way to SQL or EM to find all indexes that are not used (not accessed) in a schema?
    Greetings

    Published by: user552215 on January 26, 2012 04:15

    Salvation;

    Please see:

    Identify unused indexes [ID 144070.1]
    Identify unused indexes with the ALTER INDEX TRACKING controls [ID 136642.1]

    Respect of
    HELIOS

  • How to check the index, on the number of columns in the table is created

    How to check on the number of columns in the table the index has been created. ??

    OR

    How check index, on the number of columns in the table that it is been created?

    890306 wrote:
    How to check on the number of columns in the table the index has been created. ??

    >

    OR

    How check index, on the number of columns in the table that it is been created?

    query USER_IND_COLUMNS

    SQL> desc user_ind_columns
     Name                            Null?    Type
     ----------------------------------------- -------- ----------------------------
     INDEX_NAME                             VARCHAR2(30)
     TABLE_NAME                             VARCHAR2(30)
     COLUMN_NAME                             VARCHAR2(4000)
     COLUMN_POSITION                        NUMBER
     COLUMN_LENGTH                             NUMBER
     CHAR_LENGTH                             NUMBER
     DESCEND                             VARCHAR2(4)
    

    Handle: 890306
    Status level: Beginner
    Join date: October 8, 2011
    Messages total: 13
    Total Questions: 5 (5 open)

    Why all the question still pending?

    Published by: sb92075 on December 3, 2011 17:21

  • ORE: the names of columns not valid cost.matrix

    I'm trying to use the method odmDT with application costs customized as follows:

    > dt.mod = ore.odmDT (default ~.,credit_train,max.depth=20,cost.matrix=matrix(c(0,1,4,0),nrow=2)

    but I get the error:

    Error in ore.odmDT (default ~., credit_train, max.depth = 20, cost.matrix = error_cost):

    ORE: the names of columns not valid cost.matrix

    I can't find any documentation anywhere on how exactly this cost matrix must be specified.

    Any help would be appreciated

    The value for cost.matrix currently requires a data structure object. The following examples using the NARROW data successfully pass a frame of data for the value of cost.matrix:

    R > NARROW.costs.gender<- data.frame(actual_target_value="">

    PREDICTED_TARGET_VALUE = c("M","M","F","F"),

    COST = c (0.25, 0.75, 0.0, 0.0))

    R > NARROW.costs.class<- data.frame(actual_target_value="">

    PREDICTED_TARGET_VALUE = c (0,0,1,1),

    COST = c (0.25, 0.75, 0.0, 0.0))

    R > dt.mod1<- ore.odmdt(gender="" ~="" .,="" narrow,="" cost.matrix="">

    Summary (DT. MOD1)

    R > dt.mod2<- ore.odmdt(class="" ~="" .,="" narrow,="" cost.matrix="">

    Summary (DT. MOD2)

    I filed a bug so this behavior can be evaluated for a future release of Oracle Enterprise R.

  • ICloud emails disappear at the time of my Macbook Pro when I delete a message from iCloud of one of them?

    I'm an old Geezer Mac, but a Newbie iCloud. I just put on my two Macbook Pro iCloud email addresses and access e-mail through Apple Mail on both computers. Here are my two questions:

    (1) iCloud emails disappear at the time of my Macbook Pro when I delete a message from iCloud of one of them?

    (2) if I move an e-mail message to iCloud Inbox Mail at Mail Archive on a Macbook, can I delete the message from the second Macbook without losing the archived message?

    Yes, that is what is supposed to happen with an IMAP e-mail account.

    If you move it to a folder on the Mac, not in the iCloud account, you can remove safely icloud.

  • The slider side does not move when I put the mouse on it, I need to click below or on the arrow down. Once he left the first place, it moves. Also some applications like changing the city the weather button won't change.

    The slider side does not move when I put the mouse on it, I need to click below or on the arrow down. Once he left the first place, it moves. Also some applications like changing the city the weather button won't change.

    The extension of the Yahoo! toolbar and the extension of Babylon have been reported to cause a problem like that. Disable or uninstall the modules.

       * https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    
  • update date and time for 3.6 numbers does not show the time and does not automatically update the date

    The 'update date and time"for numbers of 3.6 does not show the time and does not automatically update the date.  What should I do?  Thank you.

    Hi david,

    where do you find ' update of the date and time.

    Quinn

  • SK2061: The wireless keyboard will not connect when the PC is turned on.

    My problem is, when I start the PC, (HPK-15 500, 319NA), wireless (SK2061) keyboard, does not connect. I have to shut down the PC so he can connect (no restart, you must stop it).  Have had the PC for 5 months and it has been published. Not changed the battery makes no difference.

    The internet statement States I shoud push the blue button until the USB receiver flashes. This PC does not have an external USB receiver, I guess it's built in! The mouse works OK.

    Hello @JimCar82,

    I read your post on how the wireless keyboard will not connect when the computer is turned on, and I'd be happy to help you in this case!

    Re-connect your keyboard to your desktop computer wireless, I advise you to follow the steps described in this document on the keyboard and wireless mouse troubleshooting. The USB receiver should be found at the back of the tower.

    Please re-post with the results of your troubleshooting, and I look forward to your response!

    Concerning

  • seconds of falling for the time stamp

    I guess someone has had this problem before, but do not see in the forum anywhere.  I add a timestamp in a file so I used the 'get time in seconds' and connected to a "convert to DBL.  Then this son in an indicator on the façade and in the Express VI "write to a measurement file.

    The indicator shows the time stamp very well, but in the file it puts it in scientific notation and cut the last 4 digits and fractions of a second.  Timestamping writes to the file every 5 seconds, so it is important to have the rest of the time stamp included.  I tried using probes on wires to see where things are weird but I get the same value truncated in the wire before and after the flag.  I thought it had something to do with the VI Express first, given that the indicator is fine, but with her truncated in the thread, it seems that the Express VI is indeed record exactly what is given to... but then again the indicator... you can see that I've been running in circles in this!  Someone knows the reason why he does this and a possible solution?

    Thank you very much!


  • Microsoft Pinball Arcade, everything works except the right flipper does not work when you run the game. __Keyboard is very good

    Microsoft Pinball Arcade, everything works except the right flipper does not work when you run the game.
    Keyboard is fine.  Is this a compatibility issue?

    ---------------

  • AiOSoftwareNPI (* .ms) the Setup program does not start when I start my computer.

    original title: AiOSoftwareNPI

    I'm having a problem with a software AiOSoftwareNPI problem (* .ms) the Setup program does not start when I start my computer.

    I know it's a Windows Installer but I don't have a disc with this route. I even tried to reinstall the windows xp disk and it does not work, I still

    get the same box when I shutdown and restart. The box allows me not to leave him continues to appear.

    Thank you

    Ms. C

    After doing a Google search for AiOSoftwareNPI and followed by the reading of many different threads in various forums, I found that it is for drivers for an HP all-in-One printer.

    You have an HP printer?

    If so, the usual suggestion was to place your HP printer disk in your CD/DVD drive and restart. After reboot would be installed the necessary files and the pop - up would more appear at startup. I don't know if it will actually work because in all the discussions I've read, none of the original poster never responded by saying that it worked or not.

    The next most common suggest was to download the latest driver for your HP printer to your version of Windows (including at the level of the ILO) and install it. Yet, not a single original poster has responded.

    In fact, if you have an HP printer I suggest to visit the web site of HP support below the link to get the latest drivers and their installation. Visit the support for the correct installation method and if you need to remove the old driver first. You can also visit the communities of Support HP for assistance (a link for communities is also on the next page).

    Support HP & drivers
     http://WWW8.HP.com/us/en/support-drivers.html

    Kind regards

  • We get the popup "USB device not recognized", when nothing is connected.

    Original title: pop up message

    I connected the USB cord to transfer information from your old phone to new phone via Itunes.  Since that time that I keep getting a pop up message that says: device not recognized USB, the defective device, windows does not recognize.  Nothing is plugged in, but message appears every few seconds.  How can I get him to stop?

    Hello

    It seems that you are getting the popup "USB device not recognized", when nothing is connected.

    What is the brand and model of your computer?

    I suggest to uninstall the USB controllers and check if you get the context menu.


    Method 1: Remove and reinstall all USB controllers


    a. clickStart, type devmgmt.msc in the start search box and press ENTER.

    b. expandBus USB controllers.

    c. right-click on each device under theBus USB controllers node and then click Uninstall to remove them one at a time.

    d. restart the computer, and windows will install the rear USB drivers.

    If reinstalling USB host controllers fails to resolve the issue, go to method 2.

    Method 2: See the procedure suggested by johnkelly46 responded on October 26, 2009, from this link.

    If you have additional problems, please reply to this post and we will be happy to help you further.

  • How to set the time stamp for incoming mail?

    How to set the time stamp for incoming mail?  I have windows vista. I use hotmail/windows live email. My computer has the time is set correctly. My e-mail timestamps incoming messages 7 hours a head of real time. Example: it is now 09:48. A new email is stamped as to settle at 16:48. How can I fix it? Note: the computer is correct.

    Thank you
    Laura
    2.13.2012

    If you mean the customer of email Windows Live Mail, the time stamp on messages is governed by your time zonesystem. Right-click on the clock in the lower right of the screen and select CONFIGURATION... Change your time zone, and then set your clock at the present time.

    If you are talking about the Windows Live Hotmail service, the time zone (s) used are those contained in your account data. Reach
    https://account.live.com/EditProf.aspx
    and change the time zones for the good...

    Windows Live programs and services have their own forums for support at the Windows Live Solution Center. Please address any questions you may have about Windows Live Mail to one of the forums on the right side of this page. For Hotmail, forums and responses are available via this page.

    Noel

  • The mouse pointer does not hide when you type, even with the box checked.

    Hello everyone.  I turned on the check mark in the properties of the mouse "hide the pointer during the strike".  However, the mouse pointer does not hide when typing, but instead remains visible all the time.

    No one knows why this happens?  In previous versions of Windows, the pointer should simply disappear when keystrokes are typed, and then reappear when the mouse is moved.  Is not the case here!

    Thanks for any information!

    System details:

    Windows Vista Ultimate x 64 SP1, 4 GB ram
    Intel Core2 3.16 GHz cpu
    NVIDIA GeForce 8800GT with two monitors
    Aero is enabled.

    Hello

    Welcome to the community of Windows Vista.

    1. what application you are working on when you encountered this problem?

    Hide the mouse pointer option allows you only to remove the mouse curzor of
    the focus in the working window so that the cursor does not cover the text or the pitcure you see.

    Make sure that the curzor of the mouse is placed inside the app as you type, as it does not hide the mouse, if it is outside of the application.

    Change the settings of the mouse
    http://windowshelp.Microsoft.com/Windows/en-us/help/efd700f8-bbc0-4F04-9f78-3bdb4bbf47011033.mspx#EKD

    Kind regards

    Technical support of Microsoft-yama.
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • the Task Manager does not appear when right-clicking on the taskbar

    The Task Manager does not appear when right-clicking on the taskbar

    Hello

    It appears when you press ctrl + shift + ESC? It seemed before? You are an administrator on this computer or is it a corporate system?

    If he has suddenly ceased to be available, it's a good sign that you have picked up a virus or some kind of malware. Formal analysis in safe mode is your first line of defense.

    Good luck, Rick Rogers, aka "Crazy" - Microsoft MVP http://mvp.support.microsoft.com Windows help - www.rickrogers.org

Maybe you are looking for

  • CAN´t install iTunnes on windows 10

    Also each time that I start to install iTunnes I get this error: An error occurred during the installation of assembly ' Microsoft.VC80.CRT.type "win32.version =" = 8.0.50727.6195.publicKey token = rArchitecture .processo ' 1fc8b3b9a 1st 18e3b "="amd

  • Mac Mail - send unknown sender / not applicable

    On one of the Mac Mail e-mail accounts stopped view my e-mails. The displayed e-mail activity showed that emails have been received. When I ran the account information on this mail box there were several mails, labeled with the unknown sender and SUB

  • Droid3 update fails to install

    My phone has downloaded the update and restarted. He "installed" the update and restarted again. (Given the small bar android and progress) After the reboot, a popup came up saying "update failed". Any ideas?

  • What is the problem in simulation in multisim

    I want to know that when I try to simulate it gives me error can someone please tell me what is the problem? Kind regards Saami

  • DVR play an Xbox

    so I tried to save lately on my xbox one but he did not appear for the option of taking a screenshot or record and I have been double clicking the home button but I still get the same results. Please help I CANT RECORD VIDEOS or TAKE screenshots of a