what is better? and why?
function a:
DELETE a FROM a LEFT JOIN b
ON a.CHROM=b.CHROM AND a.POS=b.POS
function b:
DELETE a FROM a, b
WHERE a.CHROM=b.CHROM AND a.POS=b.POS
what is better? and why?
function a:
DELETE a FROM a LEFT JOIN b
ON a.CHROM=b.CHROM AND a.POS=b.POS
function b:
DELETE a FROM a, b
WHERE a.CHROM=b.CHROM AND a.POS=b.POS
It is better to join in the FROM clause because it gets executed first. There are cases where you should join in the where but not here. So I would say function a is your best bet. On a side note, I don't think you want to do a left join in function a because you will be joining more records than you will be deleting. It may be better and more efficient to use INNER JOIN in function a. A good practice is to select before you delete or update. If you run these selects do you get the same results? You should get more results in the first query because you are using left join and the second query is similar to an inner join.
SELECT a FROM a LEFT JOIN b
ON a.CHROM=b.CHROM AND a.POS=b.POS
SELECT a FROM a, b
WHERE a.CHROM=b.CHROM AND a.POS=b.POS
check out this answer:
If need a better explanation on joins this was really helpful to me: