From: Christopher Browne Date: 2002-06-18T03:36:51+09:00 Subject: Re: Are Unix tools just slow? Centuries ago, Nostradamus foresaw when "Daniel P. Zepeda" would write: > On Sat, 15 Jun 2002 14:34:17 +0900 > Christopher Browne wrote: > >> A long time ago, in a galaxy far, far away, "Daniel P. Zepeda" >> wrote:> I guess my real contribution to this >> thread: I recently saw a post about> Ruby FAM. I thought it would be >> cool to write a tool that kept the> filesystem information in an RDBMS, >> like PostgreSQL, using FAM to keep it> updated, and also giving the >> ability to update the actual filesystem when> the database is updated. >> It would be really fast and easy to use with a> lot more features when >> compared to slocate. I've started to give it a> shot, but what do you >> all think? >> >> I think what you'd find is that the first time you did >> SELECT * FROM FILES >> it would be about as slow as running "find -print /" the first time. > > I agree. But I think you missed the point. It would only have to traverse > the filesystem once, on installation, then after that FAM would keep it > updated. No, I'm not missing the point. I'm adding one that you seem to be missing. In both cases, it would be necessary to pull a similar number of blocks of data from disk, because in both cases, there is a database being treated as a directory structure. In the case of the SQL database, there might be _some_ savings in time, from two persectives: a) The set of disk blocks might be somewhat more compact; b) If a selection criterion was being used that would allow only selecting a tiny subset, then only part of the data would get searched. Of course, b) isn't the case in "SELECT * FROM FILES". 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_. And if the database contains much the same set of data (which it does), organized in a manner not vastly dissimilar (which would be the case), then the differences in behaviour won't be vastly different. Creating a DBMS doesn't magically save you time. It comes at a cost. Querying a database comes at a cost too. -- (reverse (concatenate 'string "moc.enworbbc@" "enworbbc")) http://www3.sympatico.ca/cbbrowne/ Rules of the Evil Overlord #168. "I will plan in advance what to do with each of my enemies if they are captured. That way, I will never have to order someone to be tied up while I decide his fate."