search

Home  >  Q&A  >  body text

mysql中用多表UNION查询和一个表查询 哪个更好

天蓬老师天蓬老师2874 days ago718

reply all(1)I'll reply

  • 迷茫

    迷茫2017-04-17 15:49:52

    In most cases, table disassembly is to improve performance, but it increases development complexity and workload.
    Personally, I think that if the amount of data in a single table is less than one million, there is no need to split it into multiple tables.

    In addition, when splitting tables, you will generally feel the characteristics of business data and directly locate the query table instead of multi-table union query, which will make the query efficiency even lower.
    For example, if the table is split according to the size of the user ID, one table will be split every 100,000, so that after getting the ID, you can directly determine which table to query.

    reply
    0
  • Cancelreply