在 Azure Table 存储中,CreateIfNotExists 算作事务吗?

In Azure Table Storage does CreateIfNotExists count as transaction?

我们有一个工作代码,我正在考虑事务优化,每次我们向 table 中插入内容时,都会调用 CreateIfNotExists()。算作交易吗?我们有很多tables,对于每个客户几个,有能力通过一笔交易删除它。

插入数据是否是更好的方法,如果它因某些 "Table does not exists" 异常而失败,请创建它并再次插入数据?

Every time we insert something into table, CreateIfNotExists() is called. Is it counted as transaction?

是的。本质上 CreateIfNotExists 尝试创建一个 table 并捕获异常并将其与 Conflict (409) 状态代码进行比较。由于这是一笔 PUT 交易,您需要为此付费。

Would it be better approach to insert data and if it fails with some "Table does not exists" exception create it and insert data again?

你当然可以做到。其他方法(不确定它是否适合您)是仅在应用程序启动时检查这些 table(实际上,这就是我们在应用程序中所做的)。