https://questdb.io logo
Title
a

Alex Pelagenko

01/09/2023, 12:13 PM
that looks like optimiser bug, feel free to add github issue
Your left join btw is effectively inner join because the where
i

Imre

01/09/2023, 12:22 PM
not sure if it helps but you could try to use
with
as a workaround. something like:
with
f as (select dag_id, task_id, max(timestamp) as last_finish from ti_finish group by dag_id, task_id)
select s.*, f.*
from ti_start as s
left join f on s.dag_id = f.dag_id and s.task_id = f.task_id
where s.timestamp >= f.last_finish;
and i think Alex is right, just tested how
>=
behaves with NULL. not obvious because you could think that
something
is always greater than
NULL
which is nothing. πŸ™‚ but that is not the case.
select to_timestamp('2023-01-09T00:00:00', 'yyyy-MM-ddTHH:mm:ss') >= NULL from <table>;
gives
false
j

JM

01/09/2023, 12:36 PM
Thanks for the replies πŸ™‚ I am aware of the left join and NULLs, the query you see was rather ad hoc and grew from some other queries executed before (and I would also not use * if we are at it πŸ˜„ ) Interesting that it behaves differently with CTEs. As for Github, please be patient; I still dont have an account there and am a little busy today
a

Alex Pelagenko

01/09/2023, 12:46 PM
don’t forget to start us on gitbug too πŸ˜‰