views:

59

answers:

2

What is the fastest way to store templates? In a database (SQL Server) or a file? Those template can be from 1KB to ~15KB (usually 1-3KB).

After reading the template, I'm parsing it with Regex to HTML. I've <div>[Block Parameter="Value" Parameters2="SomeValue" ...]</div> for example, so please consider that.

Thanks.

+1  A: 

A common approach is to store the path to the file in your database, rather than the file itself. Doing so will allow you to keep your database small and lightweight. File systems are faster than databases in "serving up" the data, because it's part of the operating system and does not need to go through a large application stack such as relational database server.

edit: Whatever you're doing with the file after you've loaded it ("regex to html") is not related to how fast you can access where you stored the data in the file itself. I doubt your database is performing the "regex to html" step.

Mike Atlas
+2  A: 

Reading a file will be faster than database access. But with DB you get bonus: transactions, concurrent access, ...

Darin Dimitrov