Which provides better performance one big join or multiple queries?

后端 未结 5 1623

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 04:09

    should you do a single query that joins these 10 tables or at some point is it inefficient

    All these tables join to the order - all the records returned are related. There's nothing inefficient about grabbing everything related in as few queries or operations as possible.

    With separate queries, there's increased risk that the data may have changed between queries.

提交回复
热议问题