Azure Table 存储数据建模注意事项
Azure Table Storage data modeling considerations
我有一个用户列表。用户可以使用用户名或电子邮件地址登录。
作为 azure table 存储的初学者,这就是我为快速索引扫描的数据模型所做的。
PartitionKey RowKey Property
users:email jacky@email.com nickname:jack123
users:username jack123 email:jacky@email.com
因此,当用户通过电子邮件登录时,我会在 azure table 查询中提供 PartitionKey eq users:email
。如果是username
,Partition eq users:username
.
因为在 azure table 查询中模拟 contains
或 like
似乎是不可能的,我想知道这是否是存储多行数据的正常做法对于 1 个用户?
Since it doesn't seem possible to simulate contains or like in azure
table query, I'm wondering if this is a normal practice to store
multiple row of data for 1 user ?Since it doesn't seem possible to
simulate contains or like in azure table query, I'm wondering if this
is a normal practice to store multiple row of data for 1 user ?
这是一个完全有效的做法,实际上是推荐的做法。本质上,您必须确定可能查询 table 存储的属性,并以某种方式将它们用作 PartitionKey
和 RowKey
.
的组合
请参阅Guidelines for table design
了解更多信息。从这个 link:
Consider storing duplicate copies of entities. Table storage is cheap so consider storing the same entity multiple times (with
different keys) to enable more efficient queries.
我有一个用户列表。用户可以使用用户名或电子邮件地址登录。
作为 azure table 存储的初学者,这就是我为快速索引扫描的数据模型所做的。
PartitionKey RowKey Property
users:email jacky@email.com nickname:jack123
users:username jack123 email:jacky@email.com
因此,当用户通过电子邮件登录时,我会在 azure table 查询中提供 PartitionKey eq users:email
。如果是username
,Partition eq users:username
.
因为在 azure table 查询中模拟 contains
或 like
似乎是不可能的,我想知道这是否是存储多行数据的正常做法对于 1 个用户?
Since it doesn't seem possible to simulate contains or like in azure table query, I'm wondering if this is a normal practice to store multiple row of data for 1 user ?Since it doesn't seem possible to simulate contains or like in azure table query, I'm wondering if this is a normal practice to store multiple row of data for 1 user ?
这是一个完全有效的做法,实际上是推荐的做法。本质上,您必须确定可能查询 table 存储的属性,并以某种方式将它们用作 PartitionKey
和 RowKey
.
请参阅Guidelines for table design
了解更多信息。从这个 link:
Consider storing duplicate copies of entities. Table storage is cheap so consider storing the same entity multiple times (with different keys) to enable more efficient queries.