Home  >  Q&A  >  body text

数据库 - MySQL中,如何在“多次查询100条”、“一次查询100条数据”中取舍?

如果考虑网络环境,那肯定是一次查询100条数据的快,但是如果不考虑网络环境呢?只考虑MySQL的查询速度,是查询100次每次一条的快,还是一次查询100次的快?

阿神阿神2743 days ago783

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-17 11:55:14

    It is generally faster to query 100 items at a time. Mainly to explain the sql statement, plan the query method, and the cost of index searching, etc. In addition, the difference between queries that do not use indexes and scan the table is more obvious. One scans from beginning to end to find all the data, and the other scans 100 times each time. Scan from the beginning...

    reply
    0
  • Cancelreply