[英]Azure Table Storage Bit Data Type
I am architecting a table for my Azure Table Storage
based app, and I need it to have 100 "columns" with bit
or boolean
datatypes. 我正在为基于
Azure Table Storage
的应用程序设计一个表,并且我需要它具有100个具有bit
或boolean
数据类型的“列”。
I can obviously store int
flags as my column datatype, but since there are 100 per table entry, I would like to make the entries (aka, "rows") as small as possible. 我显然可以将
int
标志存储为我的列数据类型,但是由于每个表条目有100个,因此我想使条目(也称为“行”)尽可能小。 If I use int
flags, my entry size will be 100 bytes
, but if I'm able to use a bit
datatype, then it is obviously 8 times smaller. 如果使用
int
标志,则输入大小将为100 bytes
,但是如果我能够使用bit
数据类型,则它的大小显然要小8倍。
Booleans
seem like they should work in theory, but I just read ( here ) that Booleans take a full byte in memory. Booleans
似乎在理论上应该起作用,但我只是在这里读到了布尔值在内存中占据了整个字节。
Is there a way to have a datatype that is truly 1 bit
in size and able to be stored in Azure Table Storage
? 有没有一种方法可以使数据类型的大小真正为
1 bit
,并且可以存储在Azure Table Storage
?
Thanks! 谢谢!
The Windows Azure Storage REST API documentation provides the definitive specification of what can be done with Azure Tables. Windows Azure存储REST API文档提供了有关可以使用Azure表完成的明确规范。 The data model and supported datatypes are documented here .
此处记录了数据模型和支持的数据类型。
Since individual columns aren't indexed and result in a table scan when queried, could you not use some other storage mechanism for the data. 由于没有对各个列进行索引,因此查询时会导致表扫描,因此您是否可以不使用其他存储机制存储数据。 For example, you could store the data in a byte[] property in a Table entity.
例如,您可以将数据存储在Table实体的byte []属性中。 Indeed, if the only data you are storing in the entity are these bits then you could even use blobs instead.
确实,如果您存储在实体中的唯一数据是这些位,那么您甚至可以使用blob代替。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.