Azure Cosmos DB 简介:表 APIIntroduction to Azure Cosmos DB: Table API

适用于: 表 API

Azure Cosmos DB 提供的表 API 适用于为 Azure 表存储编写且需要以下高级功能的应用程序:Azure Cosmos DB provides the Table API for applications that are written for Azure Table storage and that need premium capabilities like:

为 Azure 表存储编写的应用程序无需更改代码便可使用表 API 迁移到 Azure Cosmos DB,并可充分利用高级功能。Applications written for Azure Table storage can migrate to Azure Cosmos DB by using the Table API with no code changes and take advantage of premium capabilities. 表 API 包含可用于 .NET、Java、Python 和 Node.js 的客户端 SDK。The Table API has client SDKs available for .NET, Java, Python, and Node.js.


无服务器容量模式现在在 Azure Cosmos DB 的表 API 上可用。The serverless capacity mode is now available on Azure Cosmos DB's Table API.


.NET Framework SDK Microsoft.Azure.CosmosDB.Table 目前处于维护模式,不久将被弃用。The .NET Framework SDK Microsoft.Azure.CosmosDB.Table is in maintenance mode and it will be deprecated soon. 请升级到新的 .NET Standard 库 Microsoft.Azure.Cosmos.Table 来继续获取表 API 支持的最新功能。Please upgrade to the new .NET Standard library Microsoft.Azure.Cosmos.Table to continue to get the latest features supported by the Table API.

表产品/服务Table offerings

如果当前使用 Azure 表存储,那么改用 Azure Cosmos DB 表 API 可以获得以下好处:If you currently use Azure Table Storage, you gain the following benefits by moving to the Azure Cosmos DB Table API:

FeatureFeature Azure 表存储Azure Table storage Azure Cosmos DB 表 APIAzure Cosmos DB Table API
延迟Latency 快速,但对延迟没有上限。Fast, but no upper bounds on latency. 读取操作和写入操作的低至个位数的毫秒级延迟(通过以下统计数据提供支持:在中国的任何位置,对于任何规模,99% 的情况下读取和写入操作的延迟 < 10 毫秒)。Single-digit millisecond latency for reads and writes, backed with <10 ms latency for reads and writes at the 99th percentile, at any scale, anywhere in China.
吞吐量Throughput 可变吞吐量模型。Variable throughput model. 表的可伸缩性限制为 20,000 个操作/秒。Tables have a scalability limit of 20,000 operations/s. 使用 SLA 支持的每个表专用保留吞吐量实现高度可缩放。Highly scalable with dedicated reserved throughput per table that's backed by SLAs. 帐户没有吞吐量上限,每个表支持 >1000 万个操作/秒。Accounts have no upper limit on throughput and support >10 million operations/s per table.
多区域分布Multiple-region distribution 具有一个可选可读辅助读取区域以实现高可用性的单一区域。Single region with one optional readable secondary read region for high availability. 从一个区域到任意数量区域的统包式多区域分布Turnkey multiple-region distribution from one to any number of regions. 支持在中国各地随时自动和手动故障转移Support for automatic and manual failovers at any time, anywhere in China. 多个写入区域,允许任何区域接受写入操作。Multiple write regions to let any region accept write operations.
索引Indexing 仅对 PartitionKey 和 RowKey 建立主索引。Only primary index on PartitionKey and RowKey. 没有辅助索引。No secondary indexes. 默认情况下,自动对所有属性完成编制索引,不进行索引管理。Automatic and complete indexing on all properties by default, with no index management.
查询Query 执行查询时使用主键的索引,否则进行扫描。Query execution uses index for primary key, and scans otherwise. 查询可以利用属性的自动索引缩短查询时间。Queries can take advantage of automatic indexing on properties for fast query times.
一致性Consistency 在主要区域内实现强一致性。Strong within primary region. 在辅助区域内实现最终一致性。Eventual within secondary region. 五个定义完善的一致性级别可基于应用程序需要权衡可用性、延迟、吞吐量和一致性。Five well-defined consistency levels to trade off availability, latency, throughput, and consistency based on your application needs.
定价Pricing 基于使用量。Consumption-based. 提供基于使用量预配容量两种模式。Available in both consumption-based and provisioned capacity modes.
SLASLAs 可用性为 99.9% 至 99.99%,具体取决于复制策略。99.9% to 99.99% availability, depending on the replication strategy. 单区域帐户的读取可用性为 99.999%、写入可用性为 99.99%,多区域帐户的写入可用性为 99.999%。99.999% read availability, 99.99% write availability on a single-region account and 99.999% write availability on multi-region accounts. 综合性 SLA:涵盖可用性、延迟、吞吐量和一致性。Comprehensive SLAs covering availability, latency, throughput and consistency.

入门Get started

Azure 门户中创建 Azure Cosmos DB 帐户。Create an Azure Cosmos DB account in the Azure portal. 然后开始使用我们的快速入门:通过 .NET 使用表 APIThen get started with our Quick Start for Table API by using .NET.


如果已在预览期间创建表 API 帐户,请新建表 API 帐户,这样才能使用正式版表 API SDK。If you created a Table API account during the preview, please create a new Table API account to work with the generally available Table API SDKs.

后续步骤Next steps

下面是一些可帮助你入门的指南:Here are a few pointers to get you started: