假设我在DynamoDB中有一个用户和图像表。
users table
userId (hash) name email
images table
imagesId (hash) userId filename
如果我想获取单个userId的所有图像,我应该如何设置范围或GSI?图像表是否应该是具有imageId(哈希)和userId(范围)的复合键,并按范围搜索(如果可能)?或者userId(是一个GSI)和查询只是userId?
答案 0 :(得分:1)
您无法仅使用DynamoDB中的范围键进行查询。
除非您希望userId
表中的查询结果按userId
排序,否则无法将其用作范围键。如果要使用查询从images表中检索具有特定userId
的所有图像,则需要在std::complex<double> res = cblas_zdotc(fpowa_d.size(), fpowa_d.data(), 1, fpowa_p.data(), 1);
func.cc:42:93: error: ‘cblas_zdotc’ was not declared in this scope
上使用GSI。
答案 1 :(得分:1)
您的图片表格中的add a GSI似乎可以使用您的表格的反向键架构:
hash key - userId
range key - imagesId
filename
- 附加财产然后,您可以使用userId
查询此GSI,以获取所有关联的imagesId
。