I have a view, which is formed from joining a table(around 25 TB) with another table(5 GB)
CREATE VIEW view1 AS
select columns(around 30 columns)
from table1
RIGHT JOIN table2
ON conditions1
where conditions2
When I run this select
select *
from view1
where date='20170320'
It finishes in a couple of minutes. But this select
select *
from view1
where date = from_unixtime(unix_timestamp(date_add(CURRENT_DATE, -1) ,'yyyy-MM-dd'), 'yyyyMMdd')
Takes forever to start(if it starts at all) and doesn't finish. There are no actual errors. It just waits until I get tired and decide to kill it.
Why is this happening?