0

Please help me understanding which of the following two queries are good from performance points. I have checked the Explain Plan cost which is same for both the queries.

1)

select tbl_LP.fn FNr, s.sourceNr SNr, Product.quantity
    from tbl_Source s, tbl_LP, Product
    where Product.tbl_Source_id=s.id and Product.tbl_LP_m_id=tbl_LP.id
    and s.sourceNr like 'T%';

2)

Select tbl_LP.fn FNr, s.sourceNr SNr, Product.quantity
    from tbl_Source s 
            INNER JOIN Product ON Product.tbl_Source_id=s.id AND s.sourceNr like 'T%'
            INNER JOIN tbl_LP ON Product.tbl_LP_m_id=tbl_LP.id;
PS078
  • 431
  • 1
  • 6
  • 18
  • 1
    They are identical from a performance perspective, as the Explain Plan has shown. They are logically identical, just expressed in different syntax. – Tony Andrews Jun 27 '17 at 13:21

1 Answers1

2

There is no diference at all. It's about how you prefer to read/mantain your queries. I prefer the join approach because you segregate the link between tables from the filters you may have. But, at bottom line, the execution plan is the guide to see if a query would perform better in a way or another. I found this other question which gave good examples on it.

What's the difference between comma separated joins and join on syntax in MySQL?

MNF
  • 82
  • 7