Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3431528
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:20:13+00:00 2026-05-18T07:20:13+00:00

Which is the better practice to store file? Directly store the file in database

  • 0

Which is the better practice to store file? Directly store the file in database or just the location to that file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T07:20:13+00:00Added an answer on May 18, 2026 at 7:20 am

    It depends. You need to consider several things.

    1. If you have a mickey mouse freeware database, meaning that it does not handle blobs appropriately (reads the blobs on every SELECT; does not store the blobs in a separate physical structure to the row; very slow with blobs; etc)

      • keep the files outside, store only the location
      • manually deal with the syncing of row.location vs the file system
    2. If you have an enterprise SQL Platform, it is no problem at all to keep the blobs inside the database. In fact, retrieval is faster. These do not read the blobs on every SELECT, they are stored in a separate physical structure to the rows. The one extra read to get the blob if the SELECT requests it, is not a "performance problem".

    3. The PAGESIZE in genuine SQL databases can be set as 2k; 4k; 8k; or 16k.

      • 2k is perfect for OLTP (small rows, small Transactions: you do not want to move 8K on every IO operation)
      • larger sizes are relevant based on how much OLAP you cater for
        • in your case, the average size of the files
        • there will be some waste in the unused portion of the last page, per row/blob.
    4. The disadvantage of keeping the blobs in the database is, your database backups will be significantly larger.

      • Some enterprise databases (eg. SAP/Sybase) recognise that a page has not changed, and excludes it from the incremental backups
      • others have no incremental database backups.
    5. The advantage of keeping the blobs in the database is:

      • data and referential integrity. You will not have the problem of having the rows that are out of synch with the blobs

      • the blobs are included in the backup: otherwise, upon a restore, the task of syncing the restored database with the restored files is a major problem.

      • I completed an assignment last year, where the customer had 130GB of data in the db, and 700GB of documents stored outside the db. After ten years of problems, they bit the bullet, and moved the documents into the db.
        Guess what, what was supposed to be a simple job (long but simple, because the references were supposed to be absolutely correct), ended up being massive, because there were so many (a) duplicates, and (b) invalid references.
        The resulting database was 630GB, there were 100GB of dupes. 2K pagesize.

    Responses to Comments

    1. Slash or Backslash
      Easy.

      • In the database, store slash only.
      • You need a way of identifying the target system, and an IsWindoze indicator. It should be higher up in the table hierarchy, not at the level where the Filename is located.
      • Whenever you report or display the Filename column, if IsWindoze, change the slashes to backslashes.

      You will have a similar problem with the DriveLetter and colon D:, which Unix does not have. Allow it only if IsWindoze.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Give me some of your thoughts on which is a better coding practice/makes more
On my site I have a config file which has many settings that need
I want to store confidential data in a digitally signed file, so that I
Which is better practice; manipulating properties with accessors by @property or self.property ?
Which is a better programming practice and why? I have a class like this:
Which is better? Or use and OR mapper with SP's? If you have a
Which is better to use in PHP, a 2D array or a class? I've
Which is better to do client side or server side validation? In our situation
Which is better in general in terms of the ordering? Do you put the
which is better ??? public class Order { private double _price; private double _quantity;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.