How do I optimize query where searching for 'is not null' on either of two linked tables
Biggest mistake is you are using * in Select.


  Do you require column from all three table in your resultset ?


Once you should try this,

if(@startdate is null)
set @startdate='17530101'

if(@enddate is null)
set @enddate='99991231'

SELECT * FROM dbo.my_first_table a   -- &gt; 1 million records
INNER JOIN dbo.my_second_table b     -- &gt; 1 million records
    on a.id = b.a_id and b.my_column_x IS NOT NULL
LEFT OUTER JOIN dbo.my_third_table c -- &gt; 1 million records
    on a.id = c.a_id and c.my_column_y IS NOT NULL
WHERE   
 b.[start_date]  &gt; @startdate
AND     b.[end_date]    &lt; @enddate