I have written a SQL query that seems very simple, tableA with primary key x, and ytime is a timestamp field.
select a.x, b.z from
# tableA join tableB etc.
where a.id not in (select x from tableA where a.ytime is not null)
There is another stackflow similar to this one but that one only talks about smaller subset of data.
Not sure if I need to index ytime column.