ok, here's the thing: If I were to create a fileserver website like Microsofts SkyDrive then how should I structure the database? There are incredibly little information about database structure on the internet (web security too) and I've searched a whole lot. Should I create a table for every user containing the files or should I have one single large table with thousands of records of files in which I have a column with the name of the user the file is belonging to?

Dani AI

Generated

Short answer: avoid one table per user and avoid putting raw file blobs into ordinary row storage at scale. Building on 's direction, keep a single, normalized metadata model that describes every file (owner, parent folder, name, mime, size, timestamps, a checksum, version id, a storage pointer) and keep the file bytes in a storage layer optimized for blobs (SQL Server FILESTREAM/FILETABLE or cloud blob storage). See SQL Server FILESTREAM recommendations and cloud blob basics for details: and Azure Blob Storage introduction.

Practical schema and operational notes to apply now: use a stable internal PK and a separate public GUID/token for sharing; store ParentId to model folders and enforce a unique constraint on (ParentId,Name) so names don’t collide in the same folder; keep StoragePath or BlobUrl and a ContentHash column for dedupe and integrity checks; index OwnerId, ParentId, and any columns used for list queries; partition large tables by range or by OwnerId when you hit millions of rows. Implement a small FileVersions table (metadata only) so versions point to immutable blobs and can be garbage-collected safely.

Security and scale concerns: use signed URLs or short-lived tokens for downloads, validate uploads server-side (mime/type/size/virus scan), support resumable uploads (chunking) for large files, implement quotas and soft-delete with periodic purge jobs, and track reference counts when deduping blobs so shared content is not removed prematurely. These patterns let a single metadata table scale cleanly while keeping storage, performance, backup, and security manageable.

Recommended Answers

All 2 Replies

what about creating two tables
1..containing the user information
2..containing the users files information.
and linking both

Yeah that is how I have it at the moment but since I haven't found any good tutorials on database structure I'm always uncertain how to design my databases. So you think that the way I'm doing it now would be the best way?

Do you know any good database resources?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.