NoSQL的查询

NoSQL的查询有两种模式, 分别是Scan与Query

  1. Scan会对整个表作扫描. 例如要查询2013年的七龙珠电影, 输入相对应的条件做Scan
    https://ithelp.ithome.com.tw/upload/images/20210921/2009194272B8tlDVmG.png

  2. Scan总共花费了275.5 Read Capacity Units找出这笔资料
    https://ithelp.ithome.com.tw/upload/images/20210921/20091942nAVDf5ynFz.png

  3. 但是如果把相同条件下在Partition Key & Sort Key使用Query方式查询
    https://ithelp.ithome.com.tw/upload/images/20210921/200919422OiomgaM2X.png

  4. 相同的结果只需花费0.5 Read Capacity Units
    https://ithelp.ithome.com.tw/upload/images/20210921/20091942fOAIioUSUt.png

  5. 但是Scan也是有方便之处. 当对搜寻条件不明确时, Scan的搜寻容许成对相对比较大. 例如只搜寻电影名称包含"Ball Z", 类似SQL Like指令.
    https://ithelp.ithome.com.tw/upload/images/20210921/20091942jPW3DpNUOZ.png

  6. Query的搜寻条件就相对有限.
    https://ithelp.ithome.com.tw/upload/images/20210921/20091942JlAWfTcaoA.png

  7. 另外无论Scan或Query, 它的属性型别只有String, Number, Binary, Boolean, Null, 搜寻条件必须符合这些型别.
    https://ithelp.ithome.com.tw/upload/images/20210921/20091942ZMZhxf7vAu.png

  8. 例如范例资料的型别是Map, 搜寻条件就无法针对这类型别使用.
    https://ithelp.ithome.com.tw/upload/images/20210921/20091942C1fJ6R2L0G.png

  9. 现在新增一笔2021年007的生死交战, 并将info栏位设成String.
    https://ithelp.ithome.com.tw/upload/images/20210921/20091942JU1UodFtUt.png

  10. 再使用Filters功能搜寻, info型别指定为String, 搜寻Daniel即可搜寻到这一笔新增资料.
    https://ithelp.ithome.com.tw/upload/images/20210921/20091942au6FW2RGzc.png

  11. 就算其他资料info栏位有Daniel, 但由於型别为Map因此就不会出现在String的搜寻结果.
    https://ithelp.ithome.com.tw/upload/images/20210921/20091942ggk4TBGzDf.png


<<:  Day 6: LeetCode 54. Spiral Matrix

>>:  ESP32_DAY6 介绍Arduino

[ Day 22 ] - 阵列资料处理 - forEach

阵列资料处理 - forEach 会将阵列中的每一个元素资料进行处理 使用范例 let dataLi...

Day11 Vue directives(v-on & v-bind)

到底什麽式Vue directives Vue directives简单来说就是一种可以挂在HTML...

Day10:时程安排

规划时间 开发时间 测试及验收 ...

Excel VBA 巨集设计问题 不同表格中VLOOKUP找资料

现在做了一个表格 内容如图下分了商品编号, 仓库号和仓库名 希望能输入商品编号後能自动带出仓库号和仓...

Day25 Lab 2 - Object storage 下载续传

Object的下载需要涉及从多个data server拿到component并组合再一起,流程如下图...