storing design file (contents) in sql server and performance


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?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
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.
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:-
Easwaran ParamasivamCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

Easwaran ParamasivamCommented:
Each file name should be unique and the same could be use as Cache KEY.
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.

akohanAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.