Which provides better performance one big join or multiple queries?

后端 未结 5 1635

i have a table called orders. one column on order is customer_id
i have a table called customers with 10 fields

Given the two options if i want to build up an array

5条回答
  •  情话喂你
    2021-02-05 03:47

    Single join should be faster for two main reasons.

    If you are querying over a network, then there is overhead in using number of queries instead of a single query.

    A join would be optimized inside the DBMS using the query optimizer so will be faster than executing several queries.

提交回复
热议问题