storing design file (contents) in sql server and performance

Posted on 2012-03-31
Last Modified: 2012-08-14

I'm writing a code which is dealing with dxf files (basically is a text file generated by AutoCad). now, in a part of the project I need to store it. Its contents can be something like:


however, it gets to several thousands of lines. I'm thinking of saving it in a field as Varchar(MAX) which supports up to 2GB of information.


Can an expert advise me on this?


the code will read dxf files from an input and stores them in sql server 2008 and yet it has to be able to reopen and show the design. this make me think of storing the files on storage device and instead store only the path/file name in the database since there will be more steps that have to go through connecting to the database, locating the data, reading the contents and creating a temp dxf file. Any advice?
Question by:akohan
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 80 total points
ID: 37792463
I would just put the path/file name in the database.  Putting the file itself in the database can take up a lot of space which can slow the database access down, requires a program to recreate the file (wasting more time), and can only be backed up by backing up the database.
LVL 20

Expert Comment

ID: 37793865
in case you still want to store file content in DB rather than its path, use varbinary(max) instead of varchar(max)...

here is an example to help you:-
LVL 16

Accepted Solution

Easwaran Paramasivam earned 120 total points
ID: 37795601
Save the file in a common place with unique name and store the full file path in DB. While you need it read the file. If you want to improve the performance you can use Caching technique. Please do refer
[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

LVL 16

Expert Comment

by:Easwaran Paramasivam
ID: 37795608
Each file name should be unique and the same could be use as Cache KEY.
LVL 33

Expert Comment

ID: 37805703
you might zip the file and store the zipped binary into a blob (varbinary). that would spare a lot of space and would be faster for both write and read cause zip/unzip was made in memory.


Author Closing Comment

ID: 37852344

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ASP.NET 5 Templates 2 65
C# Single Form 8 27
Designing and Implementing a Data Warehouse 3 13
C# guarantee sql connection close 6 13
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now