Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2002
    Location
    Toronto
    Posts
    13

    Should I store video inside a database?

    I am designing a database that will either store small video clips (1-2MB) or hold a reference to the clips' location on a server. I'm planning on using postgreSQL, and would like to know how either of these implementations will affect overall server performance.

  2. #2
    Join Date
    Jan 2003
    Location
    Midwest
    Posts
    138
    store the videos in a folder somewhere on the server...the database field would contain something like an integer or text based field as a reference to that particular video.

    Example

    Table Structure

    VideoId Int
    VideoNum Int or Varchar

    VideoId VideoNum
    1 1000_1000_1000.whatever
    2 1000_1000_1001.whatever
    3 1000_1000_1002.whatever

    your folder would then contain videos named
    1000_1000_1000.whatever
    etc...

  3. #3
    Join Date
    Mar 2002
    Location
    Toronto
    Posts
    13
    Thanks.

    Would I be bloating the database by dropping video binaries into their own fields? Just curious, I plan on using your suggestion.

  4. #4
    Join Date
    May 2002
    Location
    Florida, USA
    Posts
    49
    The whole question of storing large data objects in a database is sort of a red herring. There is not a simple answer. It is a question of your application requirements, and which particular DBMS implementation you use. Without knowing these, it is impossible to give any advice.

    So, the answer to your question depends on your answer to these:

    1. What is your reason for wanting to store them in the database? If you don't have a good reason, then its probably not necessary to store the data in the DBMS. However, sometimes there are very good reasons: you might want to apply some data integrity rules to your system, such as not allowing a video clip to be deleted when a related record still exists, or, you might want to log actions regarding the clip (INSERT,UPDATE,DELETE) with a trigger, or there might be any number of other logical integrity reasons in your application. Filesystems don't provide data integrity features.

    2. Which DBMS are you using, and which datatype do you intend to use? Everyone will tell you it is "horrible" for performance to store large files in the database, bla, bla, bla... but this is really a question of implementation, not logic. There is no real intrisic reason why it should be bad for performance. Essentially "large objects" or BLOBs are just files stored inside the DBMS's own file heirarchy, so the DBMS can manage their creation and deletion, while preserving any related constraints you might want. Thus, if you are going to need certain constraints anyway, and you end up storing your clips on the filesystem, then you will have to create those constraints in your application, thus still affecting performance. So in the end, you might not really be getting better performance by storing as files. But, the efficiency of this approach varies widely among DBMS packages, so you really need to do your own tests to evaluate this.

    So, the real answer is: it depends (inside joke for database theorists ).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •