mysql distinct耗时
时间: 2023-11-03 15:00:11 浏览: 296
根据引用内容,mysql中使用DISTINCT进行查询会耗费一定的时间。具体的耗时取决于查询的数据量和索引情况。在引用中提到了两种方案来优化DISTINCT查询的耗时,但都存在一些限制。方案一是去掉DISTINCT,虽然可以减少查询时间,但无法满足去重需求;方案二是去掉模糊查询前面的%,虽然可以加快查询速度,但查询结果可能不完整。
相关推荐



















根据引用内容,mysql中使用DISTINCT进行查询会耗费一定的时间。具体的耗时取决于查询的数据量和索引情况。在引用中提到了两种方案来优化DISTINCT查询的耗时,但都存在一些限制。方案一是去掉DISTINCT,虽然可以减少查询时间,但无法满足去重需求;方案二是去掉模糊查询前面的%,虽然可以加快查询速度,但查询结果可能不完整。