有关 Azure Cosmos DB 中的表 API 的常见问题解答Frequently asked questions about the Table API in Azure Cosmos DB

可以在 Azure 门户中使用 Azure Cosmos DB 表 API。首先必须注册一个 Azure 订阅。The Azure Cosmos DB Table API is available in the Azure portal First you must sign up for an Azure subscription. 注册成功后,可将 Azure Cosmos DB 表 API 帐户添加到 Azure 订阅,然后向帐户添加表。After you've signed up, you can add an Azure Cosmos DB Table API account to your Azure subscription, and then add tables to your account. 可以在 Azure Cosmos DB 表 API 简介中找到支持的语言和相关的快速入门。You can find the supported languages and associated quick-starts in the Introduction to Azure Cosmos DB Table API.

Azure Cosmos DB 中的表 API 与 Azure 表存储Table API in Azure Cosmos DB Vs Azure Table storage

表 API 与 Azure 表存储的行为有哪些不同之处?Where is Table API not identical with Azure Table storage behavior?

想要使用 Azure Cosmos DB 表 API 创建表的 Azure 表存储用户应注意以下这些行为差异:There are some behavior differences that users coming from Azure Table storage who want to create tables with the Azure Cosmos DB Table API should be aware of:

  • Azure Cosmos DB 表 API 使用保留容量模型来保障性能,但这意味着,一旦创建了表,就必须立即支付容量费用,即使容量未被使用。Azure Cosmos DB Table API uses a reserved capacity model in order to ensure guaranteed performance but this means that one pays for the capacity as soon as the table is created, even if the capacity isn't being used. 使用 Azure 表存储时,只需为使用的容量付费。With Azure Table storage one only pays for capacity that's used. 这也说明了,表 API 在 99% 的时间里为何能够提供 10 毫秒的读取延迟和 15 毫秒的写入延迟 SLA,而 Azure 表存储提供 10 秒延迟 SLA。This helps to explain why Table API can offer a 10 ms read and 15 ms write SLA at the 99th percentile while Azure Table storage offers a 10-second SLA. 因此,使用表 API 表(即使是不带任何请求的空表)时,要达到 Azure Cosmos DB 所提供的 SLA,必须支付费用来确保提供所需的容量来处理对这些表发出的所有请求。But as a consequence, with Table API tables, even empty tables without any requests, cost money in order to ensure the capacity is available to handle any requests to them at the SLA offered by Azure Cosmos DB.

  • 表 API 返回的查询结果未按分区键/行键顺序排序,因为它们在 Azure 表存储中。Query results returned by the Table API aren't sorted in partition key/row key order as they are in Azure Table storage.

  • 行键最多可以包含 255 个字节。Row keys can only be up to 255 bytes.

  • 批最多可以包含 2 MB。Batches can only have up to 2 MBs.

  • 目前不支持 CORS。CORS isn't currently supported.

  • Azure 表存储中的表名不区分大小写,但出现在 Azure Cosmos DB 表 API 中。Table names in Azure Table storage aren't case-sensitive, but they are in Azure Cosmos DB Table API.

  • Azure Cosmos DB 的某些编码信息内部格式,例如二进制字段,目前不如想像的那么有效。Some of Azure Cosmos DB's internal formats for encoding information, such as binary fields, are currently not as efficient as one might like. 因此,这会导致数据大小受到意外限制。Therefore this can cause unexpected limitations on data size. 例如,目前无法使用整整有 1 MB 的表实体来存储二进制数据,因为编码会增大数据大小。For example, currently one couldn't use the full one Meg of a table entity to store binary data because the encoding increases the data's size.

  • 目前不支持实体属性名称“ID”。Entity property name 'ID' currently not supported.

  • TableQuery TakeCount 不限为 1000 以内。TableQuery TakeCount isn't limited to 1000.

  • 对于 REST API,有大量的终结点/查询选项不受 Azure Cosmos DB 表 API 的支持:In terms of the REST API there are a number of endpoints/query options that aren't supported by Azure Cosmos DB Table API:

    REST 方法Rest Method(s) REST 终结点/查询选项Rest Endpoint/Query Option 文档 URLDoc URLs 说明Explanation
    GET、PUTGET, PUT /?restype=service@comp=properties 设置表服务属性获取表服务属性Set Table Service Properties and Get Table Service Properties 此终结点用于设置 CORS 规则、存储分析配置和日志记录设置。This endpoint is used to set CORS rules, storage analytics configuration, and logging settings. CORS 目前不受支持,Azure Cosmos DB 与 Azure 存储表中以不同的方式处理分析和日志记录CORS is currently not supported and analytics and logging are handled differently in Azure Cosmos DB than Azure Storage Tables
    OPTIONSOPTIONS /<table-resource-name> 预检 CORS 表请求Pre-flight CORS table request 这是 Azure Cosmos DB 目前不支持的 CORS 部分。This is part of CORS which Azure Cosmos DB doesn't currently support.
    GETGET /?restype=service@comp=stats 获取表服务统计信息Get Table Service Stats 提供有关主节点与辅助节点之间的数据复制速度的信息。Provides information how quickly data is replicating between primary and secondaries. 由于复制是写入的一部分,因此在 Cosmos DB 中不需要此选项。This isn't needed in Cosmos DB as the replication is part of writes.
    GET、PUTGET, PUT /mytable?comp=acl 获取表 ACL设置表 ACLGet Table ACL and Set Table ACL 获取和设置用于管理共享访问签名 (SAS) 的存储访问策略。This gets and sets the stored access policies used to manage Shared Access Signatures (SAS). 尽管支持 SAS,但其设置和管理方式不同。Although SAS is supported, they are set and managed differently.
  • Azure Cosmos DB 表 API 仅支持 JSON 格式,而不支持 ATOM。Azure Cosmos DB Table API only supports the JSON format, not ATOM.

  • 尽管 Azure Cosmos DB 支持共享访问签名 (SAS),但它不支持某些策略,具体而言,是与管理操作相关的策略,例如创建新表的权限。While Azure Cosmos DB supports Shared Access Signatures (SAS) there are certain policies it doesn't support, specifically those related to management operations such as the right to create new tables.

  • 对于特定的 .NET SDK,Azure Cosmos DB 目前不支持某些类和方法。For the .NET SDK in particular, there are some classes and methods that Azure Cosmos DB doesn't currently support.

    Class 不支持的方法Unsupported Method
    CloudTableClientCloudTableClient *ServiceProperties**ServiceProperties*
    *ServiceStats**ServiceStats*
    CloudTableCloudTable SetPermissions*SetPermissions*
    GetPermissions*GetPermissions*
    TableServiceContextTableServiceContext *(此类已弃用)* (this class is deprecated)
    TableServiceEntityTableServiceEntity " "" "
    TableServiceExtensionsTableServiceExtensions " "" "
    TableServiceQueryTableServiceQuery " "" "

其他常见问题Other frequently asked questions

是否需要新的 SDK 才能使用表 API?Do I need a new SDK to use the Table API?

不是,现有的存储 SDK 仍然适用。No, existing storage SDKs should still work. 但是,我们建议始终使用最新的 SDK,以获得最佳支持,并在许多场合下获得优异的性能。However, it's recommended that one always gets the latest SDKs for the best support and in many cases superior performance. 请参阅 Azure Cosmos DB 表 API 简介中的可用语言列表。See the list of available languages in the Introduction to Azure Cosmos DB Table API.

连接到表 API 需要使用哪个连接字符串?What is the connection string that I need to use to connect to the Table API?

连接字符串为:The connection string is:

DefaultEndpointsProtocol=https;AccountName=<AccountNamefromCosmosDB;AccountKey=<FromKeysPaneofCosmosDB>;TableEndpoint=https://<AccountName>.table.cosmos.azure.cn

可以通过 Azure 门户中的“连接字符串”页获取连接字符串。You can get the connection string from the Connection String page in the Azure portal.

如何在表 API 的 .NET SDK 中替代请求选项的配置设置?How do I override the config settings for the request options in the .NET SDK for the Table API?

有些设置是通过 CreateCloudTableClient 方法处理的,还有一些设置是通过客户端应用程序中 appSettings 节的 app.config 处理的。Some settings are handled on the CreateCloudTableClient method and other via the app.config in the appSettings section in the client application. 有关配置设置的信息,请参阅 Azure Cosmos DB 功能For information about config settings, see Azure Cosmos DB capabilities.

使用现有 Azure 表存储 SDK 的客户是否需要进行任何更改?Are there any changes for customers who are using the existing Azure Table storage SDKs?

无。None. 使用现有 Azure 表存储 SDK 的现有客户或新客户无需进行任何更改。There are no changes for existing or new customers who are using the existing Azure Table storage SDKs.

如何查看 Azure Cosmos DB 中存储的用于表 API 的表数据?How do I view table data that's stored in Azure Cosmos DB for use with the Table API?

可以使用 Azure 门户浏览此数据。You can use the Azure portal to browse the data. 也可以使用表 API 代码或下一个问题答案中提到的工具。You can also use the Table API code or the tools mentioned in the next answer.

哪些工具适用于表 API?Which tools work with the Table API?

可以使用 Azure 存储资源管理器You can use the Azure Storage Explorer.

灵活地采用之前指定格式的连接字符串的工具可以支持新的表 API。Tools with the flexibility to take a connection string in the format specified previously can support the new Table API. Azure 存储客户端工具页上提供了表工具的列表。A list of table tools is provided on the Azure Storage Client Tools page.

是否能控制并发操作?Is the concurrency on operations controlled?

是,乐观并发是通过使用 ETag 机制提供的。Yes, optimistic concurrency is provided via the use of the ETag mechanism.

实体是否支持 OData 查询模型?Is the OData query model supported for entities?

是,表 API 支持 OData 查询和 LINQ 查询。Yes, the Table API supports OData query and LINQ query.

是否可以在同一应用程序中同时连接到 Azure 表存储和 Azure Cosmos DB 表 API?Can I connect to Azure Table Storage and Azure Cosmos DB Table API side by side in the same application?

是,可以创建 CloudTableClient 的两个不同实例并使其通过连接字符串指向其自身的 URI 来实现此目的。Yes, you can connect by creating two separate instances of the CloudTableClient, each pointing to its own URI via the connection string.

如何将现有 Azure 表存储应用程序迁移到此服务?How do I migrate an existing Azure Table storage application to this offering?

支持使用 AzCopyAzure Cosmos DB 数据迁移工具AzCopy and the Azure Cosmos DB Data Migration Tool are both supported.

如何为此服务扩展存储大小,比如,最初我有 n GB 的数据,但一段时间后我的数据会增长到 1 TB?How is expansion of the storage size done for this service if, for example, I start with n GB of data and my data will grow to 1 TB over time?

Azure Cosmos DB 旨在通过横向缩放提供无限的存储。Azure Cosmos DB is designed to provide unlimited storage via the use of horizontal scaling. 该服务可以监视并有效地增加存储。The service can monitor and effectively increase your storage.

如何监视表 API 服务?How do I monitor the Table API offering?

可以使用表 API 的“指标”窗格来监视请求和存储使用情况。You can use the Table API Metrics pane to monitor requests and storage usage.

如何计算所需的吞吐量?How do I calculate the throughput I require?

可以使用容量估算器计算操作所需的 TableThroughput。You can use the capacity estimator to calculate the TableThroughput that's required for the operations. 有关详细信息,请参阅估算请求单位和数据存储For more information, see Estimate Request Units and Data Storage. 通常,可以将实体显示为 JSON 并且为操作提供所需数量。In general, you can show your entity as JSON and provide the numbers for your operations.

是否可以在本地将表 API SDK 用于模拟器?Can I use the Table API SDK locally with the emulator?

现在不行。Not at this time.

现有的应用程序是否适用于表 API?Can my existing application work with the Table API?

是的,支持相同的 API。Yes, the same API is supported.

如果我不想使用表 API 功能,是否需要将现有 Azure 表存储应用程序迁移到该 SDK?Do I need to migrate my existing Azure Table storage applications to the SDK if I don't want to use the Table API features?

否,可以在没有任何干扰的情况下创建和使用现有 Azure 表存储资产。No, you can create and use existing Azure Table storage assets without interruption of any kind. 但是,如果不使用表 API,则无法从自动索引、其他一致性选项或多区域分发中受益。However, if you don't use the Table API, you can't benefit from the automatic index, the additional consistency option, or multiple-region distribution.

如何在跨多个 Azure 区域的表 API 中添加数据复制?How do I add replication of the data in the Table API across more than one region of Azure?

可以使用 Azure Cosmos DB 门户的多区域复制设置来添加适合应用程序的区域。You can use the Azure Cosmos DB portal's multiple-region replication settings to add regions that are suitable for your application. 若要开发多区域分布式应用程序,还应添加其 PreferredLocation 信息已设置为本地区域的应用程序,以减轻读取延迟。To develop a multiple-regionally distributed application, you should also add your application with the PreferredLocation information set to the local region for providing low read latency.

如何在表 API 中更改帐户的主要写入区域?How do I change the primary write region for the account in the Table API?

可以使用 Azure Cosmos DB 的多区域复制门户窗格来添加区域,然后故障转移到所需的区域。You can use the Azure Cosmos DB multiple-region replication portal pane to add a region and then fail over to the required region. 有关说明,请参阅使用多区域 Azure Cosmos DB 帐户进行开发For instructions, see Developing with multi-region Azure Cosmos DB accounts.

在分发数据时,如何配置首选读取区域以实现较低的延迟?How do I configure my preferred read regions for low latency when I distribute my data?

可使用 app.config 文件中的 PreferredLocation 键,帮助从本地位置进行读取。To help read from the local location, use the PreferredLocation key in the app.config file. 对于现有应用程序,如果设置 LocationMode,表 API 会引发错误。For existing applications, the Table API throws an error if LocationMode is set. 请删除该代码,因为表 API 会从 app.config 文件中选取此信息。Remove that code, because the Table API picks up this information from the app.config file.

如何理解表 API 中的一致性级别?How should I think about consistency levels in the Table API?

Azure Cosmos DB 在一致性、可用性和延迟之间提供合理的平衡。Azure Cosmos DB provides well-reasoned trade-offs between consistency, availability, and latency. Azure Cosmos DB 为表 API 开发人员提供五个一致性级别,因此可以在表级别选择合适的一致性模型,并在查询数据时发出相应的请求。Azure Cosmos DB offers five consistency levels to Table API developers, so you can choose the right consistency model at the table level and make individual requests while querying the data. 客户端建立连接后,可以指定一致性级别。When a client connects, it can specify a consistency level. 可以通过 CreateCloudTableClient 的 consistencyLevel 参数更改级别。You can change the level via the consistencyLevel argument of CreateCloudTableClient.

如果将“有限过时”一致性设置为默认值,表 API 可通过“读取自己写入的数据”提供低延迟的读取。The Table API provides low-latency reads with "Read your own writes," with Bounded-staleness consistency as the default. 有关详细信息,请参阅一致性级别For more information, see Consistency levels.

默认情况下,Azure 表存储在区域内提供非常一致性,在辅助位置中提供最终一致性。By default, Azure Table storage provides Strong consistency within a region and Eventual consistency in the secondary locations.

Azure Cosmos DB 表 API 是否比 Azure 表存储提供更多的一致性级别?Does Azure Cosmos DB Table API offer more consistency levels than Azure Table storage?

是,有关如何受益于 Azure Cosmos DB 的分布式特性的信息,请参阅一致性级别Yes, for information about how to benefit from the distributed nature of Azure Cosmos DB, see Consistency levels. 由于为一致性级别提供了保障,因此可以放心使用它们。Because guarantees are provided for the consistency levels, you can use them with confidence.

启用多区域分发后,需要花费多长时间复制数据?When multiple-region distribution is enabled, how long does it take to replicate the data?

Azure Cosmos DB 会在本地区域持续提交数据,然后在几毫秒内将数据立即推送到其他区域。Azure Cosmos DB commits the data durably in the local region and pushes the data to other regions immediately in a matter of milliseconds. 此复制仅依赖于数据中心的往返时间 (RTT)。This replication is dependent only on the round-trip time (RTT) of the datacenter. 若要详细了解 Azure Cosmos DB 的全球分布功能,请参阅 Azure Cosmos DB:Azure 上的多区域分布式数据库服务To learn more about the global-distribution capability of Azure Cosmos DB, see Azure Cosmos DB: A multiple-regionally distributed database service on Azure.

是否可以更改读取请求一致性级别?Can the read request consistency level be changed?

使用 Azure Cosmos DB 时,可以在容器级别(在表上)设置一致性级别。With Azure Cosmos DB, you can set the consistency level at the container level (on the table). 使用 .NET SDK,可以通过在 app.config 文件中提供 TableConsistencyLevel 键值来更改级别。By using the .NET SDK, you can change the level by providing the value for TableConsistencyLevel key in the app.config file. 可能的值包括:“强”、“有限过期”、“会话”、“一致前缀”和“最终”。The possible values are: Strong, Bounded Staleness, Session, Consistent Prefix, and Eventual. 有关详细信息,请参阅 Azure Cosmos DB 中的可优化数据一致性级别For more information, see Tunable data consistency levels in Azure Cosmos DB. 关键是不能将请求的一致性级别设置为高于表的一致性级别。The key idea is that you can't set the request consistency level at more than the setting for the table. 例如,不能将表的一致性级别设置为“最终”,而将请求的一致性级别设置为“非常”。For example, you can't set the consistency level for the table at Eventual and the request consistency level at Strong.

在某个区域出现故障时,表 API 如何处理故障转移?How does the Table API handle failover if a region goes down?

表 API 利用 Azure Cosmos DB 的多区域分布式平台。The Table API leverages the multiple-regionally distributed platform of Azure Cosmos DB. 若要确保应用程序能够容许数据中心停机,需在 Azure Cosmos DB 门户中至少再为帐户启用一个区域(使用多区域 Azure Cosmos DB 帐户进行开发)。To ensure that your application can tolerate datacenter downtime, enable at least one more region for the account in the Azure Cosmos DB portal Developing with multi-region Azure Cosmos DB accounts. 可以通过使用门户设置区域的优先级(使用多区域 Azure Cosmos DB 帐户进行开发)。You can set the priority of the region by using the portal Developing with multi-region Azure Cosmos DB accounts.

可为帐户添加任意数目的区域,并通过提供故障转移优先级控制可将帐户故障转移到的区域。You can add as many regions as you want for the account and control where it can fail over to by providing a failover priority. 若要使用数据库,还需要在那里提供一个应用程序。To use the database, you need to provide an application there too. 这样,客户就不会遇到停机情况。When you do so, your customers won't experience downtime. 最新的 .NET 客户端 SDK 可自动寻址,但其他 SDK 则不可以。The latest .NET client SDK is auto homing but the other SDKs aren't. 也就是说,它能够检测到有故障的区域,并自动故障转移到新区域。That is, it can detect the region that's down and automatically fail over to the new region.

是否能够为表 API 启用备份?Is the Table API enabled for backups?

可以,表 API 利用 Azure Cosmos DB 的平台进行备份。Yes, the Table API leverages the platform of Azure Cosmos DB for backups. 可自动创建备份。Backups are made automatically. 有关详细信息,请参阅使用 Azure Cosmos DB 联机备份和还原For more information, see Online backup and restore with Azure Cosmos DB.

表 API 是否默认对实体的所有属性编制索引?Does the Table API index all attributes of an entity by default?

是,默认情况下会对实体的所有属性进行索引。Yes, all attributes of an entity are indexed by default. 有关详细信息,请参阅 Azure Cosmos DB:索引策略For more information, see Azure Cosmos DB: Indexing policies.

这是否意味着,无需创建多个索引来满足查询要求?Does this mean I don't have to create more than one index to satisfy the queries?

是,Azure Cosmos DB 表 API 针对所有属性提供自动索引,无需任何架构定义。Yes, Azure Cosmos DB Table API provides automatic indexing of all attributes without any schema definition. 此自动化功能使开发人员能够将重心放在应用程序上,而不必担心索引的创建和管理。This automation frees developers to focus on the application rather than on index creation and management. 有关详细信息,请参阅 Azure Cosmos DB:索引策略For more information, see Azure Cosmos DB: Indexing policies.

是否可以更改索引策略?Can I change the indexing policy?

是,可以提供索引定义来更改索引策略。Yes, you can change the indexing policy by providing the index definition. 需要适当地将这些设置编码并转义。You need to properly encode and escape the settings.

对于非 .NET SDK,只能在门户中设置索引策略,方法是:打开“数据资源管理器”,导航到想要更改的特定表,转到“缩放和设置”->“索引策略”,进行所需的更改,并单击“保存”。 For the non-.NET SDKs, the indexing policy can only be set in the portal at Data Explorer, navigate to the specific table you want to change and then go to the Scale & Settings->Indexing Policy, make the desired change and then Save.

对于 .NET SDK,可以在 app.config 文件中提交更改:From the .NET SDK it can be submitted in the app.config file:

{
  "indexingMode": "consistent",
  "automatic": true,
  "includedPaths": [
    {
      "path": "/somepath",
      "indexes": [
        {
          "kind": "Range",
          "dataType": "Number",
          "precision": -1
        },
        {
          "kind": "Range",
          "dataType": "String",
          "precision": -1
        }
      ]
    }
  ],
  "excludedPaths":
[
 {
      "path": "/anotherpath"
 }
]
}

平台形式的 Azure Cosmos DB 似乎拥有许多功能,例如排序、聚合、分层和其他功能。Azure Cosmos DB as a platform seems to have lot of capabilities, such as sorting, aggregates, hierarchy, and other functionality. 是否会将这些功能添加到表 API 中?Will you be adding these capabilities to the Table API?

表 API 提供与 Azure 表存储相同的查询功能。The Table API provides the same query functionality as Azure Table storage. Azure Cosmos DB 还支持排序、聚合、地理空间查询、层次结构和各种内置函数。Azure Cosmos DB also supports sorting, aggregates, geospatial query, hierarchy, and a wide range of built-in functions. 有关详细信息,请参阅 SQL 查询For more information, see SQL queries.

何时应更改表 API 的 TableThroughput?When should I change TableThroughput for the Table API?

符合以下任一情况时,都应更改 TableThroughput:You should change TableThroughput when either of the following conditions applies:

  • 要执行数据提取、转换和加载 (ETL) 操作,或者想在短时间内上传大量数据。You're performing an extract, transform, and load (ETL) of data, or you want to upload a lot of data in short amount of time.
  • 需要后端的容器或容器组提供更大的吞吐量。You need more throughput from the container or from a set of containers at the back end. 例如,发现已用吞吐量超过预配吞吐量,且吞吐量已达到限制。For example, you see that the used throughput is more than the provisioned throughput, and you're getting throttled. 有关详细信息,请参阅为 Azure Cosmos 容器设置吞吐量For more information, see Set throughput for Azure Cosmos containers.

是否可以纵向扩展纵向缩减表 API 表的吞吐量?Can I scale up or scale down the throughput of my Table API table?

是,可以使用 Azure Cosmos DB 门户的缩放窗格来缩放吞吐量。Yes, you can use the Azure Cosmos DB portal's scale pane to scale the throughput. 有关详细信息,请参阅设置吞吐量For more information, see Set throughput.

是否为新预配的表设置了默认 TableThroughput?Is a default TableThroughput set for newly provisioned tables?

是,如果未通过 app.config 替代 TableThroughput,并且未使用 Azure Cosmos DB 中预创建的容器,服务则会创建吞吐量为 400 的表。Yes, if you don't override the TableThroughput via app.config and don't use a pre-created container in Azure Cosmos DB, the service creates a table with throughput of 400.

对于 Azure 表存储服务的现有客户,定价是否有任何变化?Is there any change of pricing for existing customers of the Azure Table storage service?

无。None. 对于现有的 Azure 表存储客户,价格上没有任何更改。There's no change in price for existing Azure Table storage customers.

表 API 的价格是如何计算的?How is the price calculated for the Table API?

价格取决于分配的 TableThroughput。The price depends on the allocated TableThroughput.

如何在表 API 服务中处理对表设置的任何速率限制?How do I handle any rate limiting on the tables in Table API offering?

如果请求速率超出了为基础容器或容器组预配的吞吐量的容量,则会出现错误,SDK 会使用重试策略重试调用。If the request rate is more than the capacity of the provisioned throughput for the underlying container or a set of containers, you get an error, and the SDK retries the call by applying the retry policy.

为何需要选择吞吐量而不是 PartitionKey 和 RowKey 来利用 Azure Cosmos DB 的表 API 服务?Why do I need to choose a throughput apart from PartitionKey and RowKey to take advantage of the Table API offering of Azure Cosmos DB?

如果未在 app.config 文件中或通过门户提供吞吐量,Azure Cosmos DB 将为容器设置默认的吞吐量。Azure Cosmos DB sets a default throughput for your container if you don't provide one in the app.config file or via the portal.

Azure Cosmos DB 针对操作设置上限,在性能和延迟方面提供保障。Azure Cosmos DB provides guarantees for performance and latency, with upper bounds on operation. 如果引擎可以针对租户的操作实施调控,则可以做到这一点。This guarantee is possible when the engine can enforce governance on the tenant's operations. 设置 TableThroughput 可确保在吞吐量和延迟方面获得保障,因为平台会保留此容量,并保证操作成功。Setting TableThroughput ensures that you get the guaranteed throughput and latency, because the platform reserves this capacity and guarantees operational success.

通过使用吞吐量规范,可以弹性更改吞吐量,以利用应用程序的季节性,满足吞吐量需求并节省成本。By using the throughput specification, you can elastically change it to benefit from the seasonality of your application, meet the throughput needs, and save costs.

Azure 表存储对我而言非常便宜,因为我只需支付数据的存储费用,并且我很少进行查询。Azure Table storage has been inexpensive for me, because I pay only to store the data, and I rarely query. 但是,即使我未执行任何事务或存储任何数据,Azure Cosmos DB 表 API 服务似乎也要收费。The Azure Cosmos DB Table API offering seems to be charging me even though I haven't performed a single transaction or stored anything. 是否能解释一下?Can you explain?

根据设计,Azure Cosmos DB 是一个多区域分布式的、基于 SLA 的系统,在可用性、延迟和吞吐量方面提供保证。Azure Cosmos DB is designed to be a multiple-regionally distributed, SLA-based system with guarantees for availability, latency, and throughput. 在 Azure Cosmos DB 中保留吞吐量时,获得的保障与其他系统不同。When you reserve throughput in Azure Cosmos DB, it's guaranteed, unlike the throughput of other systems. Azure Cosmos DB 会根据客户请求提供额外功能,例如辅助索引和多区域分布。Azure Cosmos DB provides additional capabilities that customers have requested, such as secondary indexes and multiple-region distribution.

在向 Azure 表存储引入数据时,我从未收到过“配额已满”通知(指示分区已满)。I never get a quota full" notification (indicating that a partition is full) when I ingest data into Azure Table storage. 但使用表 API 时会收到此消息。With the Table API, I do get this message. 是此产品有限制,迫使我更改现有的应用程序吗?Is this offering limiting me and forcing me to change my existing application?

Azure Cosmos DB 是基于 SLA 的系统,可提供无限缩放,并在延迟、吞吐量、可用性和一致性方面提供保障。Azure Cosmos DB is an SLA-based system that provides unlimited scale, with guarantees for latency, throughput, availability, and consistency. 为了确保获得有保障的高级性能,需确保数据大小和索引可管理且可缩放。To ensure guaranteed premium performance, make sure that your data size and index are manageable and scalable. 我们对每个分区键的实体数或项数实施 20 GB 限制,以确保提供强大的查找和查询性能。The 20-GB limit on the number of entities or items per partition key is to ensure that we provide great lookup and query performance. 若要确保即使针对 Azure 存储,应用程序也能很好地进行缩放,建议不要创建热分区,即,将所有信息存储在一个分区内并查询它。To ensure that your application scales well, even for Azure Storage, we recommend that you not create a hot partition by storing all information in one partition and querying it.

表 API 是否仍然需要 PartitionKey 和 RowKey?So PartitionKey and RowKey are still required with the Table API?

是的。Yes. 由于表 API 的外围应用类似于 Azure 表存储 SDK,因此使用分区键可以高效地分发数据。Because the surface area of the Table API is similar to that of the Azure Table storage SDK, the partition key provides an efficient way to distribute the data. 行键在该分区中是唯一的。The row key is unique within that partition. 需要存在行键且它不能为 null(在标准 SDK 中可为 null)。The row key needs to be present and can't be null as in the standard SDK. RowKey 的长度为 255 个字节,PartitionKey 的长度为 1 KB。The length of RowKey is 255 bytes and the length of PartitionKey is 1 KB.

表 API 的错误消息有哪些?What are the error messages for the Table API?

Azure 表存储和 Azure Cosmos DB 表 API 使用相同的 SDK,因此,大多数错误是相同的。Azure Table storage and Azure Cosmos DB Table API use the same SDKs so most of the errors will be the same.

在表 API 中尝试一个接一个地创建许多表时,为何会受到限制?Why do I get throttled when I try to create lot of tables one after another in the Table API?

Azure Cosmos DB 是基于 SLA 的系统,在可用性、延迟和吞吐量方面提供保障。Azure Cosmos DB is an SLA-based system that provides latency, throughput, availability, and consistency guarantees. 由于它是预配的系统,因此会保留资源来保证满足这些要求。Because it's a provisioned system, it reserves resources to guarantee these requirements. 以较快的速率创建表会被系统检测到并受到限制。The rapid rate of creation of tables is detected and throttled. 建议查看表创建速率,将其降至每分钟不超过 5 个。We recommend that you look at the rate of creation of tables and lower it to less than 5 per minute. 请记住,表 API 是预配的系统。Remember that the Table API is a provisioned system. 只要预配它,就必须付费。The moment you provision it, you'll begin to pay for it.

如何提供有关 SDK 的反馈或 Bug?How do I provide feedback about the SDK or bugs?

可以通过以下任一方式分享反馈:You can share your feedback in any of the following ways:

后续步骤Next steps