WHERE 子句中的列顺序重要吗? [英] Does the order of columns in a WHERE clause matter?

查看:64
本文介绍了WHERE 子句中的列顺序重要吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WHERE 子句中列的顺序会影响性能吗?

Does the order of the columns in a WHERE clause effect performance?

例如

假设我将具有更高独特性潜力的列放在首位,反之亦然?

Say I put a column that has a higher potential for uniqueness first or visa versa?

推荐答案

如果有一个不错的查询优化器:它不应该.

With a decent query optimiser: it shouldn't.

但在实践中,我怀疑它可能.

But in practice, I suspect it might.

您只能通过测量来判断您的情况.并且测量值可能会随着数据库中数据分布的变化而变化.

You can only tell for your cases by measuring. And the measurements will likely change as the distribution of data changes in the database.

这篇关于WHERE 子句中的列顺序重要吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆