In my opinion, for multi-table queries, matching is faster than joining. namely

\

select a.*,b.* from a,b where a.id=b.id

\

than

\

select a.*,b.* from a inner join b on a.id=b.id

\

Fast. \

\

This is particularly evident in the external connection.

\

Therefore, the need to use external join, such as

\

Select a.* from a left outer join b on a.id=b.id where a.id= some value \

\

I’ll write it like this

\

Select a.* from a,b where a.id=b.id and A. id= a

UNION ALL

Select a.* from a where a.id= a AND NOT EXISTS(select 1 from b where id=a.id)

 

That’s not optimal. You could write it this way

 

WITH w AS (select * from a WHERE a.id=某值)

select w.* from w,b where w.id=b.id

UNION ALL

select w.* from w where NOT EXISTS(SELECT 1 FROM b WHERE id=w.id)

\

\

Is this the case? In doubt. \