I am looking to design a database that'll allow me to store references to files. The table is pretty simple:
Id (GUID)(PK)
Path (nvarchar(250))
IsPublic (bit)
FileType (int)
The files can be accessed via url by putting the GUID in the url, such as files/{GUID}
, so if request comes in, I can query the table by the GUID as Primary Key.
Do you think this is a valid approach? What insert/query performance am I looking at with hundreds of millions of records?
The database engine is Microsoft SQL Server.
Some queries I am predicting:
SELECT * FROM Files where ID = {GUID}
INSERT INTO Files () VALUES ()
UPDATE Files SET IsPublic = true WHERE ID = {GUID}
UPDATE Files SET Label = {NewLabel} WHERE ID = {GUID}
DELETE FROM Files WHERE ID = {GUID}
Most work will happen in select and insert. There will be very few updates and deletes. Maybe 10 inserts per second at its peak.
Each service stores the FileIds next to the tables that use it. Items service has ItemFiles which will then retrieve the Files from the service/table.
NEWSEQIENTIALID()
, assuming the most recently inserted files are also the most often used.