由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - An interview question: data store schema design (转载)
相关主题
一道面筋题目~Insert bounding box
L 家设计题求讨论BST的insertion
{0xFACEB00C>>2 in decimal}@fb.com到底是啥?what's the difference of back_inserter and inserter in c++
Linux 面试题目(付答案)收集分享One interview question (A)
design an in-memory file systemleetcode 的 Insert Interval 就是过不了大的
dropbox 要求真高啊这里还有比我更弱的么?
get Top 1million most frequent entries in past 24 houramazon版上面试问题请教
问个snapchat的设计题报offer from Amazon &MS, 同时谢谢大家 在板上学到好多东西
相关话题的讨论汇总
话题: files话题: user话题: userid话题: file
进入JobHunting版参与讨论
1 (共1页)
y****3
发帖数: 131
1
【 以下文字转载自 Database 讨论区 】
发信人: yh1213 (yh), 信区: Database
标 题: An interview question: data store schema design
发信站: BBS 未名空间站 (Sat Mar 24 18:30:54 2012, 美东)
Design a backend store for storing metadata about files and directories
belonging to different users as part of an online storage service. The
logical data model is as follows:
--a user has zero or more files or directories
--a directory contains zero or more files or sub-directories
--a file or directory has a relative path that is up to 32KB in length
--a file has a size and last modified time
This store should handle the following online queries efficiently:
--lookups on single files or sub-directory given a user and relative path
--listing all files and sub-directories belonging to a user or at a given
level of the hierarchy inserting new files and directories
It should also support the following batch operations that run on a daily
basis:
--count the total number of files per user, and the aggregate file size.
--count the number of files and sub-directories added per day for each user.
I can think of creating such a schema:
1. User table (userName, userId, etc)
2. File table (userId, file/dirName, relativePath, size, lastModified,
isFile) whereas as key, and is a foreign key
to User table.
Not sure if this the right answer. Also, if the data grow to say, billions
of rows, would sharding a good enough solution?
1 (共1页)
进入JobHunting版参与讨论
相关主题
报offer from Amazon &MS, 同时谢谢大家 在板上学到好多东西design an in-memory file system
分享amazon onsite ( rejected)dropbox 要求真高啊
Amazon Second phoneget Top 1million most frequent entries in past 24 hour
Amazon第一轮面试问个snapchat的设计题
一道面筋题目~Insert bounding box
L 家设计题求讨论BST的insertion
{0xFACEB00C>>2 in decimal}@fb.com到底是啥?what's the difference of back_inserter and inserter in c++
Linux 面试题目(付答案)收集分享One interview question (A)
相关话题的讨论汇总
话题: files话题: user话题: userid话题: file