Review
A reader, February 11, 2019 - 11:01 am UTC
Thanks, Connor. It's been really helpful.
Anything to have in mind about performance when dealing with dates in the where condition over huge tables (thousands of millions rows)?
Thanks in advance.
February 12, 2019 - 1:05 am UTC
Nothing different to any other condition.
The most common "problem" is when people make assumptions about dates, so they write things like:
where date_col > '01-jan-00'
ie, a string not a date. That's a bad idea.
or they revert to using strings entirely:
where to_char(date_col) > '01-jan-00'
That's a *really* bad idea.
Review
Geraldo Peralta, February 13, 2019 - 4:02 pm UTC
Ok. Thanks for the reply.
What about the index if the date column has the time component?
Thanks in advanced.
February 13, 2019 - 4:39 pm UTC
A date in Oracle Database always has a time component. By convention a "date with no time" has the time set to midnight.
As long as you have no functions on the date column, i.e. you're NOT doing trunc ( date_col ), the database can use the index just fine.
Review
Geraldo Peralta, February 13, 2019 - 4:48 pm UTC
Good.
Thanks for the quick response.
February 14, 2019 - 4:25 am UTC
Glad we could help