From: Christopher Browne Date: 2002-06-20T05:26:13+09:00 Subject: Re: Are Unix tools just slow? In an attempt to throw the authorities off his trail, Chris Gehlker transmitted: > On 6/17/02 11:36 AM, "Christopher Browne" wrote: >> If an SQL database is being used, then perhaps the _filesystem_ >> doesn't have to get traversed, but that certainly doesn't eliminate >> the need to traverse the _database_. > > But the difference is the difference between accessing *one* file and > accessing *every* file. That's tremendous. But that's _not_ the difference. A "find" command does _not_ read every file. It reads a database containing metadata about the files. It does not read the contents of those files. In effect, "find" is doing _exactly the same thing_. It does _not read every file_. Let me say that several more times, because that fact seems not to be sinking in successfully. It ("file") _does not read every file_. It _does not read every file_. _IT DOES NOT READ EVERY FILE_. There is no "tremendous difference." If all "find" is being used for is to get names of files (and perhaps attributes), then it is _not reading the files_. It is reading a database of metadata. If you're walking through a filesystem that has 17,000 files, then a run of "find" will have to walk through the set of filesystem blocks that contain 17,000 directory entries containing the metadata for those 17,000 files. Change that to a SQL query, and it changes _insubstantially_ to walking through the set of database blocks that contain 17,000 directory entries containing the metadata for those 17,000 files. The only crucial difference between those approaches is that the data may be somewhat more compact in an SQL database. Otherwise, there is no reason to expect _any_ difference in overall behaviour. RDBMSes are commonly implemented as B-Trees. Filesystem directory structures are also commonly implemented as B-Trees. Not a difference. -- (concatenate 'string "cbbrowne" "@cbbrowne.com") http://www.ntlug.org/~cbbrowne/fs.html >Ever heard of .cshrc? That's a city in Bosnia. Right? (Discussion in comp.os.linux.misc on the intuitiveness of commands.)