简体   繁体   English

没有关系存储数据的最佳方法是什么?

[英]What's the best way to store data with no relation?

I'm creating a mobile note application (Android & iOS), and I want to have a server for users to sync notes across multiple devices. 我正在创建一个移动便笺应用程序(Android和iOS),并且希望有一个服务器供用户在多个设备上同步便笺。 At the moment, I store all the notes locally in one single table (SQLite) on each device. 目前,我将所有注释本地存储在每个设备的一个表(SQLite)中。
So my question is: What is the best way to store all the notes in my server? 所以我的问题是:将所有笔记存储在服务器中的最佳方法是什么? I'm thinking of creating one table for each user because it would be a waste to scan all other notes when they are completely irrelevant. 我正在考虑为每个用户创建一个表,因为在其他笔记完全不相关时扫描所有其他笔记会很浪费。 But I'm not sure if this solution will scale well. 但是我不确定该解决方案是否可以很好地扩展。 As regarding DB storage, should I go for traditional db like mysql or no-sql approach? 至于数据库存储,我应该选择传统的数据库,例如mysql或no-sql方法吗? Any suggestion would be greatly appreciated. 任何建议将不胜感激。

By relational databases we never add one database / user. 通过关系数据库,我们永远不会添加一个数据库/用户。 You have to add an users table and a notes table, and the notes should have an user id, so they can be filtered out per user. 您必须添加一个用户表和一个注释表,并且注释应具有用户标识,以便可以按用户过滤掉它们。 That's all by relational database. 这就是关系数据库。

Depending on how many users and notes you have, you can do it with filesystem (an XML or JSON file per user), with SQLite, MySQL, PostgreSQL, or with newSQL databases like voltDB (ordered by increasing load). 根据您拥有多少用户和注释,您可以使用文件系统(每个用户一个XML或JSON文件),SQLite,MySQL,PostgreSQL或voltDB等newSQL数据库(按增加的负载排序)来完成此操作。 It depends on how many notes we are talking about, for example up to 100.000 the PostgreSQL is okay. 这取决于我们正在讨论的注释数,例如PostgreSQL可以支持100.000。

By noSQL there are many different database types, each for a specific job. 通过noSQL,有许多不同的数据库类型,每种类型用于一个特定的工作。 You can find every noSQL database here. 您可以在这里找到每个noSQL数据库 I am not an expert of how to choose noSQL database, but I think in your case a document store like MongoDB or CouchDB is a good choice if you want to store the users and the notes under the same database. 我不是如何选择noSQL数据库的专家,但是我认为,如果要将用户和注释存储在同一数据库中,那么像MongoDB或CouchDB这样的文档存储是一个不错的选择。 But that's just an opinion, I am not an expert of the noSQL topic. 但这只是一种意见,我不是noSQL主题的专家。 You can read more here about how to model your data in noSQL databases. 您可以在此处阅读更多有关如何在noSQL数据库中建模数据的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM