From kragen@dnaco.net Fri Aug 28 13:28:37 1998 Date: Fri, 28 Aug 1998 13:28:36 -0400 (EDT) From: Kragen To: systalk@ml.org Subject: Re: [ST] 1 DB File vs. 5 files/user: Speed In-Reply-To: <35E6DC7F.4FC6E872@earthlink.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Keywords: X-UID: 1557 Status: O X-Status: On Fri, 28 Aug 1998, Mooneer Salem wrote: > Does anyone know if searching through 1 database file is faster than > seperate files per user? It depends on how the database file is organized. If it's hashed (like gdbm) then there should not be any significant difference if what you're doing is retrieving the record for a particular key. If it's tree-based, it may be log n slower. That is, the time to walk the tree might increase proportional to the logarithm of the number of records in the database. So searching 1,000,000 records would likely be roughly three times as slow as searching 100 records. (Again, I'm assuming you're retrieving the record for a particular key.) If it's unindexed (like /etc/passwd) it'll take time proportional to the size of the file. If you're doing something that requires looking at all the records (like sorting them, or looking for a record with a particular property which your indexes don't help you with) then it'll take time proportional to the size of the file. Hope this helps. Kragen -- Kragen Sitaker We are forming cells within a global brain and we are excited that we might start to think collectively. What becomes of us still hangs crucially on how we think individually. -- Tim Berners-Lee, inventor of the Web