同じ結果が得られる形式で記述する場合は、クエリアナライザが同じ*クエリプランを使用することを期待してください。 ,
を使用すると、2つの異なるクエリのパフォーマンスを比較したい場合は、最も簡単な方法は、両方を実行して、どのくらい彼らを比較することですあまり明確であり、そして数十年
のために廃止されましたので、それは、使用しない,
を登録しようとクエリプランを比較することで異なることを確認していますが(EXPLAIN query text here
がmysqlでクエリのプランを提供します)
「私は彼らが異なる結果を出すのは知っていますが、プログラミングでは決して賢明なことではありません。あなたは常にあなたが望む結果を正確に知るべきです。
I.e.
select table1.a ,table2.b from table1 ,table2 where table1.id=table2.id
は
select table1.a ,table2.b from table1 join table2 on table1.id=table2.id
と
select table1.a ,table2.b from table1 left join table2 on table1.id=table2.id
と同じ意味を
select table1.a ,table2.b from table1 ,table2 where table1.id=table2.id
union
select table1.a , null from table1 where table1.id not in (select table2.id from table2)
と同じ意味を持っており、あなたが使用していないフォームに参加しています
select table1.a ,table2.b from table1 right join table2 on table1.id=table2.id
は
select table1.a ,table2.b from table1 ,table2 where table1.id=table2.id
union
select null, table2.b from table2 where table2.id not in (select table1.id from table1)
そして
select table1.a ,table2.b from table1 full join table2 on table1.id=table2.id
私は質問を理解していない
select table1.a ,table2.b from table1 ,table2 where table1.id=table2.id
union
select table1.a , null from table1 where table1.id not in (select table2.id from table2)
union
select null, table2.b from table2 where table2.id not in (select table1.id from table1)
と同じ意味を持っていると同じ意味を持っています。あなたは詳細を教えていただけますか? – 0xCAFEBABE
2つは同等ではありません。 'LEFT JOIN'は一致する' table2'行を持たない 'table1'行を返します。デカルト積はこれらの行を返しません。 – Barmar
@ 0xCAFEBABE上記の2つの方法を使用して同じデータを照会しますが、どのような場合にパフォーマンスが向上するかを知りたい場合 – lpgad