views:

279

answers:

5

Currently my website is written in ASP.NET Webforms using a SQL Server database. I am planning to build a ASP.NET MVC application not because it's better but because I want to learn the technology. My question is more specific to the database. I can create the database and import my SQL table via the import feature of the web interface to the SQL database or I can use a "local" database MDF file. I like the idea of using a MDF file because it will be easier to backup and deal with. My website doesn't get a lot of traffic... matter of fact I could be the only user. :) Now here is the question.

How much of a performance hit will I get by using a local SQL Server MDF file instead for my database?

+2  A: 

Effectively none. Or really none more than having the DB run on the same box as the web site. It is still a Sql Server Express database all the same. Production-wise, you probably want the DB running on a separate box dedicated to serving databases. But code-wise, the only difference will be your connection string.

Wyatt Barnett
+2  A: 

SQL Server uses a MDF file for each database on its server. There is no difference between a MDF file and a 'database' because the 'database' gets stored in a MDF file anyway.

tomlog
+1  A: 

Performance wise you should not see a difference.

The biggest issue is with production deployment and management. It is MUCH easier to manage a standard database, than a dynamically attached .mdf.

Mitchel Sellers
Remember that I'm just some guy that want to run a website. Not going to be much management except downloading for backing up the database. I will have to download the database, patch it then upload the patch database. I'm assuming that would be the process of updating the tables.
Bobby Cannon
If that is the case you might be ok, but if you want to use SSMS to manage anything while it is running, then it becomes very flaky. I've never had a good experience with .mdf files in production.
Mitchel Sellers
A: 

Also, don't forget that your web host has to support this as well. And since SQL Server Express is the only SKU that supports "user instance" databases, the host will have to have Express installed for you to use it as-is. OTOH, you can develop with it this way and then just deploy your database and change the connection string when you deploy to the web host.

GalacticCowboy
A: 

The only difference beyond the normal resource limits of the Express version of SQL Server is a negligable startup cost while the SQL Express engine connects to the MDF file, does its routine checks for file integrity and transaction log stuff.

This should only happen on application start up, not for every request.

Redbeard 0x0A