Quantcast
Channel: Admins Goodies » filesystems
Viewing all articles
Browse latest Browse all 11

Is looking up a filename in a directory of 20,000 items as efficient as looking up a row in a database?

$
0
0

Question

I’m trying to decide between storing some XML data either under uniquely identified file paths on a Linux filesystem, or in text columns in a database table. All other things being equal, is access time given a item identifier (either incorporated into the file path or a database unique column) roughly equal?

I expect maybe 20,000 items.

Asked by dan

Answer

20,000 is nothing for a database, but hefty for a file system if they are all in a single folder.

If you break them apart into separate folders (perhaps use the first 2 or 4 letters of the GUID) this will help.

It also depends on your workload. If you are doing a lot of blocking/locked queries on the table, use the file system.

If you want to store metadata with the files and access them from a 3rd party, use the db.

If you want to roll your own authentication to interface with the files, use the db.

If you want to be able to easily modify the files from say notepad, use the file system.

If they are big, use the file system. You don’t want 20gb of files in your table if you can avoid it.

Answered by Mark Henderson

Viewing all articles
Browse latest Browse all 11

Trending Articles