是BIT字段比SQL Server中的int字段快吗? [英] Is BIT field faster than int field in SQL Server?

查看:50
本文介绍了是BIT字段比SQL Server中的int字段快吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表中包含一些字段,该字段的值将为10.此表的超时时间将非常大.使用bit数据类型好还是使用不同的类型更好地提高性能?当然,所有字段都应建立索引.

I have table with some fields that the value will be 1 0. This tables will be extremely large overtime. Is it good to use bit datatype or its better to use different type for performance? Of course all fields should be indexed.

推荐答案

通常,bit最快,尤其是在您不允许null的情况下.实际上,即使使用量很大,这也可能无关紧要.但是,如果该值仅是0或1,为什么不使用一点呢?听起来,这是确保该值不会填充无效值(例如2或-1)的最佳方法.

Officially bit will be fastest, especially if you don't allow nulls. In practice it may not matter, even at large usages. But if the value will only be 0 or 1, why not use a bit? Sounds like the the best way to ensure that the value won't get filled with invalid stuff, like 2 or -1.

这篇关于是BIT字段比SQL Server中的int字段快吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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