Multiple tables or one mega-table in SQL?

后端 未结 5 480
攒了一身酷
攒了一身酷 2021-01-13 04:52

I am new to MySQL. I am trying to design an online file storage system. The actual file storage will be taken care of separately - I just want to use MySQL to make a databas

5条回答
  •  無奈伤痛
    2021-01-13 05:36

    For sure, one large table; MySQL is powerful and efficient and fast and it won't mind a million records. With a single table, you can write more simpler queries to retrieve any data, like:

    • what is the total number of files or per user
    • what is the total number of files per file type
    • what is the average file size
    • amount of file size consumed per user

    Make sure that your indexes are rightly created, which will depend on the types of queries you intend to run.

    Also, if there won't be very frequent writes to your tables, I'd suggest you go for MyISAM storage engine because of its higher performance. However, if contrary, go for InnoDB that supports row-level locking and therefore fewer locking conflicts.

    Hope you'll soon experience how fun MySQL is :-)

提交回复
热议问题