angular - Efficient NoSQL data model for large collections
问题描述
Scenario:
There are 1,000,000 coordinates (pixels) in an element.
A coordinate consists of x: number, y: number
Users select a single coordinate to 'activate'
Objective to User:
Show a count of unique coordinates activated.
i.e. 247,456 out of 1,000,000 coordinates have been activated
DB Objectives:
How should such a large data set be modeled in NoSQL?
Approach #1 Pre-populate a collection with the possible coordinates and remove them / increment a counter as the coordinates are activated
Searching through the list would be expensive, but only improve as more coordinates are activated.
Approach #2 Have a growing collection of documents as the coordinates are activated and increment.
Reading/writing would become increasingly expensive without an efficient architecture.
解决方案
使用第二种方法,只需花时间围绕它构建一个良好的架构,因为这将非常有用并进一步降低文档的读取成本以删除第一种方法中的坐标
推荐阅读
- javascript - Is there any other simple way to change my vanilla JavaScript code?
- python - Time complexity for a sorted container
- asp.net - Put method in web api (EF)
- python - 在 IE 中使用 Selenium python 的整页截图
- flutter - 按其值排序列表映射,保持 Flutter 中的顺序
- javascript - div仅在外边缘单击时更改颜色?
- filter - Logstash 过滤掉多个字符串
- regex - 如何构建正则表达式,它跳过单词中的任何大括号“[”字符或只打最后一个字符?
- php - 键为“0, 1”的数组的键“”不存在
- android - 防止 onSwiped 从 Kotlin 视图中移除项目