Store Files in SQL Server or keep them on the File Server?

前端 未结 7 683
我在风中等你
我在风中等你 2020-12-29 13:49

Currently we have thousands of Microsoft Word files, Excel files, PDF\'s, images etc stored in folders/sub folders. These are generated by an application on a regular basis

相关标签:
7条回答
  • 2020-12-29 14:01

    Rather than writing a custom DMS (document management system), you should probably consider buying one or using WSS / SharePoint as this will handle all the mundane details (storage, indexing, meta-data) and let you build your custom functionality on top.

    0 讨论(0)
  • 2020-12-29 14:03

    What kind of documents are we talking about?

    Storing documents in your SQL server might be useful because you can relate the documents to other tables and use techniques like Full-text indexing and do things like fuzzy searches.

    A downside is that it might be a bit harder to create a backup of the documents. And compression is also possible with NTFS compression or other techniques.

    0 讨论(0)
  • 2020-12-29 14:06

    rule of thumb for doc size is:

    size < 256 kb: store in db
    265 kb < size < 1 MB: test for your load
    size > 1 Mb: store on file system
    

    EDIT: this rule of thumb also applies for FILESTREAM storage in SQL Server 2008

    0 讨论(0)
  • 2020-12-29 14:09

    I would have both.

    I would keep the files renamed with an unique name, thus easier to manage, and i would keep all meta data inside the database (file name, content-type, location on file system, size, description, etcetera), so the files are accessed through the database (indirectly).

    Advantages:

    • files are easy to handle; you can bring several drives in the mix
    • the database can keep any number of meta information, including file description on which you can search against.
    • keep track on file accesses and other statistic information
    • rearrange the files using various paradigms: tree (directory structure), tags, search or context

    You can have compression on a drive also. You can have RAID for backup and speed.

    0 讨论(0)
  • 2020-12-29 14:21

    A big benefit of stroing docs in the DB is it becomes much easier to control security access to them, as you can do it all via access control in your app. Storing them on a file server requires dealing with access priveledges at the file and folder level to prevent any direct access. Also have them in a DB makes for a single point of backup, so you can more easily make a full copy and/or move it around if needed.

    0 讨论(0)
  • 2020-12-29 14:24

    If you upgrade all the way, to SQL Server 2008, then you can use the new FILESTREAM feature, that allows the document to appear as a column in a table, yet to reside as a file on a share, where it can be directly accessed by a program (like Word).

    0 讨论(0)
提交回复
热议问题