Firebird is faster than filesystem for blob storage!To blob or not to blob... good question!
I guess if you develop data intensive applications dealing with large files at some point, you've thought about it at least once: should I put my data files inside the database or should I write them directly to disk?
There are a number of interesting links to consider:
Just google it and you'll get a big number of entries.
Ok, so here's my point:
storing files in Firebird is faster than writing the same files on the filesystem!
Which is pretty good for all the structured storage true believers, I think.
Ok, let's take a look at the figures, here's my program which is able to recursively take the files in a directory, split them in 4Mb chunks and write them to another directory or a firebird database.
For my test I used a tree with:
And here's the output, first writing to Firebird and then to a filesystem.
>writedir d:\testcode d:\repodata fb
Total time 27669 ms
>writedir d:\testcode d:\repodata
Total time 40378 ms
A hash is calculated for each file chunk which also takes some time.
What I believe is pretty interesting is how writing to a Firebird database (which stores small files saving disk space since it only uses one single file!) is actually faster than dumping the same content to disk!!
Of course, there are a number of situations where high-perf software (including SCM) can benefit from using a FS instead of a database, but blob storage (with Firebird :-P) is not one of them...
You can find the full source code here.