dpmrakfbx820320638 2012-02-23 20:37
浏览 75

MySQL上每个用户的单个SQLite数据库?

Starting a new project here and I'm going to be storing a LOT of user data. I'm trying to make the system scalable from the start so I'm considering the fairly new idea of storing each user's data (essentially lists of files they have stored) in separate SQLite databases stored in a user-specific directory, rather than one huge table in MySQL with user IDs. The file list will store other metadata related to the file so just using the filesystem isn't an option.

My thought there is that when users are logged in and viewing their files it will be faster to just show all data in a single SQLite database rather than have MySQL go over all records in the "file" table to pull out one user's file by ID. Each user will easily have 10,000+ entries and there will initially be at least 400 users. So 400 individual SQLite databases with 10,000 rows, or a single MySQL table with 4 million? Keeping in mind that all 400 users will rarely (if ever) be logged in at the same time it seems inefficient to have the database have to deal with data for users that aren't there, even if it is indexed.

The single biggest restriction of SQLite is the locking but luckily in this case there will only ever be a single process writing to the database so that shouldn't be a problem here. The added administration of backing up the individual SQLite databases is trivial since they're all going to be part of the incremental filesystem backup anyway.

Thoughts? Opinions? Am I over thinking this?

  • 写回答

4条回答 默认 最新

  • dongxuan1660 2012-02-23 20:38
    关注

    My thought there is that when users are logged in and viewing their files it will be faster to just show all data in a single SQLite database rather than have MySQL go over all records in the "file" table to pull out one user's file by ID.

    No, not if you index the MySQL database properly. 4 million records should present no trouble if you've got things set up correctly.

    评论

报告相同问题?

悬赏问题

  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?