I am always confused about selecting columns with date datatypes and the performance associated to it
Example:
sql> select hiredate from EMP where hiredate='01-JAN-06';
no rows selected.
sql> select hiredate from EMP where trunc(hiredate)='01-JAN-06';
hiredate
--------
01-JAN-06
If I have indexed on hiredate and the EMP contains million rows...
then it will be doing full table scan because i am
reformatting the column with a function right?
How can I write the query to use the index performance?
Thanks hunnie
Behind The Success And Failure Of A Man Is A Woman
That would be a dumb design/coding.. you shud have used trunc(sysdate) while laoding.. makes lots of sense.
+1
In general people wouldn't have a hire date that included a component like "10:15:27" ... it would just be a date. In fact I think that it's unlikely that sysdate would be a good default for a hire date -- almost certainly that would be populated "in advance".
Bookmarks