哪个更好的SQL数据库或json文件?

时间:2022-05-22 12:52:06

I am creating an application where large number of data will be stored in the server. For example a to-do list.

我正在创建一个应用程序,其中大量数据将存储在服务器中。例如待办事项列表。

A user comes, writes down his to-do list like a list of 100 tasks for each day. So, all the task will be shown to him like a list (of 100 strings).

用户来了,写下他的待办事项列表,就像每天100个任务的列表一样。因此,所有任务都将像一个列表(100个字符串)一样显示给他。

Which will be better to store the data:

哪个更好地存储数据:

  1. A SQL table

    一个SQL表

    todo_table(datetime, user_id, todo_string)
    
  2. A JSON file

    一个JSON文件

    For each user, there will be a folder, and a day folder within them like -

    对于每个用户,将有一个文件夹,其中的日期文件夹如下 -

    abc_user(folder)

    abc_user(文件夹)

     --> 12/01/16(folder) --> json file
     --> 13/01/16(folder) --> json file
     --> 14/01/16(folder) --> json file
    

    .. and similarly for other users.

    ..和其他用户类似。

    Each json file will have an array of objects like

    每个json文件都有一个对象数组

    [
        {
            "time":"12:05",
            "task":"Wake up"
        },
        {
            "time":"01:10",
            "task":"Read"
        },
        {
            "time":"03:15",
            "task":"Dance"
        }
        .
        .
        .
    ]
    

Please tell me which would be the better approach with respect to latency, efficiency, security.

请告诉我哪种方法在延迟,效率和安全性方面更好。

Can SQL handle such large number of data in a single table? Remember, that each user will make up to 100 entries each day and if 1000 users do the same, the total entry will be 100,000 per day.

SQL可以在一个表中处理如此大量的数据吗?请记住,每个用户每天最多可填写100个条目,如果1000个用户执行相同操作,则每个用户每天最多可填写100,000个条目。

1 个解决方案

#1


2  

A sql database is the only way to go. Any distribution of SQL will be able to handle this with ease. What you do on the server shouldn't affect latency. You have many options, including encrypting your data, depending on the SQL distribution to make your database secure. Assuming your indexing is solid SQL will be more efficient than looping through a file system and then parsing JSON files.

一个sql数据库是唯一的方法。 SQL的任何分发都可以轻松处理。您在服务器上执行的操作不应影响延迟。您有许多选项,包括加密数据,具体取决于SQL分发以确保数据库安全。假设您的索引是可靠的SQL将比循环文件系统然后解析JSON文件更有效。

#1


2  

A sql database is the only way to go. Any distribution of SQL will be able to handle this with ease. What you do on the server shouldn't affect latency. You have many options, including encrypting your data, depending on the SQL distribution to make your database secure. Assuming your indexing is solid SQL will be more efficient than looping through a file system and then parsing JSON files.

一个sql数据库是唯一的方法。 SQL的任何分发都可以轻松处理。您在服务器上执行的操作不应影响延迟。您有许多选项,包括加密数据,具体取决于SQL分发以确保数据库安全。假设您的索引是可靠的SQL将比循环文件系统然后解析JSON文件更有效。