Re: newbie to cdb
Tim Goodwin <[email protected]> 26 Feb 2003 12:14:26 -0000
| Newsgroups | gmane.comp.djb.cdb |
|---|---|
| Message-ID | <[email protected]> |
> Can this database used like mysql?? cdb is almost, but not quite, entirely unlike MySQL :-). cdb provides a hash table. A hash table maps a key to a value. In the case of cdb, both keys and values can be arbitrary binary strings (even including `\0'), but there is no structure beyond that. The "db" part of the name comes from analogy with the venerable Unix libraries such as dbm (which are also hash tables). The "c" is for "constant": cdb differs from dbm in that, once a cdb file has been created, it cannot be modified. (You can, of course, create a new cdb file containing similar data, perhaps even pulling it from the old file, although more often there's a "master" text file. Although this might feel like an update, you're really replacing the entire table.) The constant aspect of cdb files avoids a lot of the complications inherent in dbm (not to mention MySQL!). This makes cdb ideal for applications that require very fast lookup of data that doesn't change very often. A good example, of course, is mail routing information: you might change it every day, or every hour, but in the meantime 10000 instances of the mail router have performed lookups. The Unix password and group files would be ideal candidates for storing in a cdb file, but I haven't heard that anybody's done that yet. Tim.