php - MySQL database: one media table or one table for images and one for videos? -


i making social network users can upload , post images , videos. now, don't know if it's better make 1 table in database, name media, , have media_type column or make separate images , videos tables. tables practically same, having id, url, user_id , description.

edit

i using php laravel, , i'm trying figure out best way setup database. if have media table easier grab media 1 function

public function media()   {       return $this->hasmany(media::class);   }  

but maybe not better option. first bigger project , don't have experience mysql.

this isn't great question s/o doesn't have actual answer, but:

  • multiple table advantages: faster when have few million records, possibly easier code.
  • single table advantages: possibly less disk usage.

i guess depends on you're looking looking for.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -