Reputation: 17
select * from ITEM_STG where STATUS = 'PROCESSED_CROSSREF' AND TRUNC(Creation_date) < Trunc(sysdate)-10
Upvotes: 0
Views: 775
Reputation: 6721
Try:
select
*
from ITEM_STG
where STATUS = 'PROCESSED_CROSSREF'
AND Creation_date < Trunc(sysdate)-10
I don't even have to know the Database Management System. But if you apply * any * expression to a column in a table that you want to use as part of a join or filter condition, any index on that column will be ignored. There is no reliable way for the optimiser to guess what the expression will do to the column's value, so any cost optimising prediction is impossible. The expression could make things better, in theory, but more often than not, it makes things worse.
So the optimiser will just ignore any data access improvement database objects in evaluating the query.
Upvotes: 3