什么是 Azure 表存储?What is Azure Table storage ?


本文中的内容适用于原始的 Azure 表存储。The content in this article applies to the original Azure Table storage. 但是,现在有一种表存储的替代产品/服务:Azure Cosmos DB 表 API。However, there is now an alternative offering for table storage: the Azure Cosmos DB Table API. 此 API 提供更高的性能和可用性、全局分发和自动辅助索引。This API offers higher performance and availability, global distribution, and automatic secondary indexes. 它还可用于基于使用量的无服务器模式。It is also available in a consumption-based serverless mode. Azure Cosmos DB 中的表 API 和 Azure 表存储之间存在某些功能差异There are some feature differences between Table API in Azure Cosmos DB and Azure table storage. 有关详细信息,请参阅 Azure Cosmos DB 表 APIFor more information, see Azure Cosmos DB Table API.

Azure 表存储是一项用于在云中存储非关系结构化数据(也称为结构化 NoSQL 数据)的服务,通过无架构设计提供键/属性存储。Azure Table storage is a service that stores non-relational structured data (also known as structured NoSQL data) in the cloud, providing a key/attribute store with a schemaless design. 因为表存储无架构,因此可以很容易地随着应用程序需求的发展使数据适应存储。Because Table storage is schemaless, it's easy to adapt your data as the needs of your application evolve. 对于许多类型的应用程序来说,访问表存储数据速度快且经济高效,在数据量相似的情况下,其成本通常比传统 SQL 要低。Access to Table storage data is fast and cost-effective for many types of applications, and is typically lower in cost than traditional SQL for similar volumes of data.

可以使用表存储来存储灵活的数据集,例如 Web 应用程序的用户数据、通讯簿、设备信息,或者服务需要的其他类型的元数据。You can use Table storage to store flexible datasets like user data for web applications, address books, device information, or other types of metadata your service requires. 可以在表中存储任意数量的实体,并且一个存储帐户可以包含任意数量的表,直至达到存储帐户的容量极限。You can store any number of entities in a table, and a storage account may contain any number of tables, up to the capacity limit of the storage account.

什么是表存储What is Table storage

Azure 表存储可存储大量结构化数据。Azure Table storage stores large amounts of structured data. 该服务是一个 NoSQL 数据存储,接受来自 Azure 云内部和外部的通过验证的呼叫。The service is a NoSQL datastore which accepts authenticated calls from inside and outside the Azure cloud. Azure 表最适合存储结构化非关系型数据。Azure tables are ideal for storing structured, non-relational data. 表存储的常见用途包括:Common uses of Table storage include:

  • 存储 TB 量级的结构化数据,能够为 Web 规模应用程序提供服务Storing TBs of structured data capable of serving web scale applications
  • 存储无需复杂联接、外键或存储过程,并且可以对其进行非规范化以实现快速访问的数据集Storing datasets that don't require complex joins, foreign keys, or stored procedures and can be denormalized for fast access
  • 使用聚集索引快速查询数据Quickly querying data using a clustered index
  • 使用 OData 协议和 LINQ 查询以及 WCF 数据服务 .NET 库访问数据Accessing data using the OData protocol and LINQ queries with WCF Data Service .NET Libraries

可以使用表存储来存储和查询大型结构化非关系型数据集,并且表会随着需求的增加而扩展。You can use Table storage to store and query huge sets of structured, non-relational data, and your tables will scale as demand increases.

表存储概念Table storage concepts

表存储包含以下组件:Table storage contains the following components:


  • URL 格式: Azure 表存储帐户使用此格式:http://<storage account>.table.core.chinacloudapi.cn/<table>URL format: Azure Table Storage accounts use this format: http://<storage account>.table.core.chinacloudapi.cn/<table>

    Azure Cosmos DB 表 API 帐户使用此格式:http://<storage account>.table.cosmosdb.azure.cn/<table>Azure Cosmos DB Table API accounts use this format: http://<storage account>.table.cosmosdb.azure.cn/<table>

    可以直接使用此地址和 OData 协议来访问 Azure 表。You can address Azure tables directly using this address with the OData protocol. 有关详细信息,请参阅 OData.orgFor more information, see OData.org.

  • 帐户: 对 Azure 存储进行的所有访问都要通过存储帐户完成。Accounts: All access to Azure Storage is done through a storage account. 有关存储帐户的详细信息,请参阅存储帐户概述For more information about storage accounts, see Storage account overview.

    对 Azure Cosmos DB 进行的所有访问都要通过表 API 帐户完成。All access to Azure Cosmos DB is done through a Table API account. 有关创建表 API 帐户的详细信息,请参阅创建表 API 帐户See Create a Table API account for details creating a Table API account.

  • Table:表是实体的集合。Table: A table is a collection of entities. 表不对实体强制实施架构,这意味着单个表可以包含具有不同属性集的实体。Tables don't enforce a schema on entities, which means a single table can contain entities that have different sets of properties.

  • 实体:与数据库行类似,一个实体就是一组属性。Entity: An entity is a set of properties, similar to a database row. Azure 存储中的实体大小最大可以为 1MB。An entity in Azure Storage can be up to 1MB in size. Azure Cosmos DB 中的实体大小最大可以为 2MB。An entity in Azure Cosmos DB can be up to 2MB in size.

  • 属性:属性是名称/值对。Properties: A property is a name-value pair. 每个实体最多可包含 252 个用于存储数据的属性。Each entity can include up to 252 properties to store data. 每个实体还具有三个系统属性,分别指定分区键、行键和时间戳。Each entity also has three system properties that specify a partition key, a row key, and a timestamp. 对具有相同分区键的实体的查询速度将更快,并且可以在原子操作中插入/更新这些实体。Entities with the same partition key can be queried more quickly, and inserted/updated in atomic operations. 一个实体的行键是它在一个分区内的唯一标识符。An entity's row key is its unique identifier within a partition.

有关命名表和属性的详细信息,请参阅 了解表服务数据模型For details about naming tables and properties, see Understanding the Table Service Data Model.

后续步骤Next steps