DELETED www/html_node/Back_002dends.html Index: www/html_node/Back_002dends.html ================================================================== --- www/html_node/Back_002dends.html +++ www/html_node/Back_002dends.html @@ -1,106 +0,0 @@ - - - - - -zeptodb: Back-ends - - - - - - - - - - - - - - - - - - - - -
-

-Previous: , Up: Introduction   [Contents][Index]

-
-
- -

1.2 Back-ends

- -

By default, zeptodb uses the GNU dbm (GDBM) library to create and manipulate the DBM databases. -Alternatively, you may choose to use the -Kyoto Cabinet library -instead. This is specified by passing the ---with-kyotocabinet option to the configure script -before compiling zeptodb. -

-

Note that databases created with these two different back-ends are -not compatible, thus databases created with Kyoto Cabinet can -only be accessed by zeptodb if it has been compiled with support for -the library. -

-

Databases created with Kyoto Cabinet are required to have the -.kch file extension. By convention, databases created with -GDBM should have the .db file extension. -

-

For most purposes, databases created with GDBM should be sufficient. -For particularly large data sets, however, Kyoto Cabinet is -preferred, since it can add values more quickly and has a much larger -upper limit on the database size. On the other hand, Kyoto Cabinet is -not as widely available in GNU/Linux distributions as GDBM so it often -must be installed manually. -

- - - - - Index: www/html_node/Commands.html ================================================================== --- www/html_node/Commands.html +++ www/html_node/Commands.html @@ -1,10 +1,10 @@ - - + zeptodb: Commands @@ -31,69 +31,72 @@ - + + - +

Next: , Previous: , Up: Top   [Contents][Index]


2 Commands

-

Three commands are provided with zeptodb: zdbc, for creating +

Five commands are provided with zeptodb: zdbc, for creating databases, zdbs for storing records in them, zdbf, -for fetching records, and zdbr, for removing records. +for fetching records, zdbr, for removing records, and +zdbi for displaying information about a database.

+ Index: www/html_node/Copying-This-Manual.html ================================================================== --- www/html_node/Copying-This-Manual.html +++ www/html_node/Copying-This-Manual.html @@ -1,10 +1,10 @@ - - + zeptodb: Copying This Manual @@ -31,44 +31,44 @@ - + + - +

Next: , Previous: , Up: Top   [Contents][Index]

Index: www/html_node/GNU-Free-Documentation-License.html ================================================================== --- www/html_node/GNU-Free-Documentation-License.html +++ www/html_node/GNU-Free-Documentation-License.html @@ -1,10 +1,10 @@ - - + zeptodb: GNU Free Documentation License @@ -35,40 +35,40 @@ + - +

Previous: , Up: Copying This Manual   [Contents][Index]

Index: www/html_node/Index.html ================================================================== --- www/html_node/Index.html +++ www/html_node/Index.html @@ -1,10 +1,10 @@ - - + zeptodb: Index @@ -34,40 +34,40 @@ + - +

Previous: , Up: Top   [Contents][Index]

Index: www/html_node/Introduction.html ================================================================== --- www/html_node/Introduction.html +++ www/html_node/Introduction.html @@ -1,10 +1,10 @@ - - + zeptodb: Introduction @@ -35,74 +35,77 @@ + - +

Next: , Previous: , Up: Top   [Contents][Index]


1 Introduction

-

zeptodb is a small collection of relatively tiny command-line tools for -interacting with DBM databases. For the uninitiated, DBM -databases are flat (non-relational) a databases; in other words, they -are persistent key-value hash tables. Typically they are created via a -library for C, Python, Perl, etc. These tools fill in a gap by providing -useful command-line tools. Some DBM libraries come with really basic -binaries for manipulating the databases, but they are not designed to be -very flexible or useful in the real world. +

zeptodb is a small collection of relatively tiny command-line tools +for interacting with DBM databases. DBM databases are flat +(non-relational) a databases; in other words, they are persistent +key-value hash tables. Typically they are created via a library for C, +Python, Perl, etc. These tools fill in a gap by providing useful +command-line tools. Some DBM libraries come with really basic binaries +for manipulating the databases, but they are not designed to be very +flexible or useful in the real world.

-

These tools may be helpful in scripts, for example, when persistant data -storage is needed but when a full database would be overkill. DBM -databases offer a constant look-up time for any record in them, as +

These tools may be helpful in scripts, for example, when persistant +data storage is needed but when a full database would be overkill. +DBM databases offer a constant look-up time for any record in them, as opposed to, say, searching through a text file, which scales linearly -with the number of lines in the file. Thus, scripts requiring fast data -look-up would benefit greatly from them. These commands may also be -useful if, for whatever reason, one would like to manipulate, via the -command-line or scripts, DBM databases created by other programs. +with the number of lines in the file. Thus, scripts requiring fast +data look-up would benefit greatly from them (but note that, of +course, disk access is slower than memory access, so if you really +need the performance and you can fit your table in memory, these are +not the appropriate tools). These commands may also be useful if, for +whatever reason, one would like to manipulate, via the command-line or +scripts, DBM databases created by other programs.

- Index: www/html_node/Tutorial.html ================================================================== --- www/html_node/Tutorial.html +++ www/html_node/Tutorial.html @@ -1,10 +1,10 @@ - - + zeptodb: Tutorial @@ -30,110 +30,68 @@ - + + - +

-Next: , Previous: , Up: Introduction   [Contents][Index]

+Next: , Previous: , Up: Introduction   [Contents][Index]


1.1 Tutorial

-

The zeptodb tools are used to create small databases that are stored to -disk and then to store, fetch and remove records from those databases. -Note that these databases are much simpler than, say, SQL databases. -The databases follow the DBM format as created by the GDBM library -(see Back-ends). Each record in a DBM database consists of a key and -a value. All keys and values are stored as plain text, regardless of -their formats. +

The zeptodb tools are used to create small databases that are stored +to disk and then to store, fetch and remove records from those +databases. These databases are much simpler than, say, SQL databases, +so no queries need to be constructed. The databases follow the DBM +format as created by the GDBM library. Each record in a DBM database +consists of a key and a value. All keys and values are stored as +plain text, regardless of their formats.

First, you create a new database with zdbc:

$ zdbc foo.db
 
-

Note: the following two paragraphs contain technical information that is -only necessary if you will be creating large databases with many -records. If that is not the case, you may safely skip them. -

-

You can customize the creation of a database in two ways. The first is -by specifying the number of buckets that comprise the database, -specified via the -b/--num-buckets option. A DBM -database can be imagined as a series of buckets. When a new item is -added, an algorithm determines which bucket it belongs in based on its -key. Likewise, the same algorithm will be used in determining the -bucket from which to fetch an item. If each bucket only contains a -maximum of one item, then you are guaranteed to be able to find any item -in the same amount of time as any other item. On the other hand, if the -number of buckets is smaller than the number of items, then when you go -to fetch an item from a bucket, you might then have to search through -all the items in that bucket to find the one that you want. This might -slow you down. On the other hand, if the number of buckets is far -greater than the maximum number of items that will be added, the -algorithm will be wasteful. Thus it’s best to use a number of buckets -that will be slightly greater than the expected maximum number of items. -As a rule of thumb, use about four times more buckets. -

-

The second option is the size (in bytes) of the memory mapped region to -use, via the -m/--mmap-size option. While the -database is stored on the disk as a file, when it is opened by zeptodb, -some or all of that file is mapped in a one-to-one manner with a region -of virtual memory. Thus, when the program reads from some address in -that region of memory, it reads directly from the corresponding address -in the file. This will generally speed up reading and writing compared -to traditional file access. If the memory-mapped region is smaller than -the size of the database, only portions of the file can be mapped at a -time, thus slowing down performance. Therefore, it is recommended to -use a sufficiently larger value than the size of the database (taking -into account the expected number of records and the size of the data -that is expected to fill the record values). -

-

Thus, for a big database, you might do: -

-
-
$ zdbc --num-buckets=10000 --mmap-size=512000000 big.db
-
-

With the database created, you may now store values to it using zdbs. zdbs normally takes its input from stdin. It expects one record per line and for each key/value pair to be separated by a delimiter character (’|’ by default). Note that records are unique: an attempt to store a record with a @@ -231,12 +189,12 @@ within your scripts.


-Next: , Previous: , Up: Introduction   [Contents][Index]

+Next: , Previous: , Up: Introduction   [Contents][Index]

Index: www/html_node/index.html ================================================================== --- www/html_node/index.html +++ www/html_node/index.html @@ -1,10 +1,10 @@ - - + zeptodb: Top @@ -29,45 +29,45 @@ - + + - +

zeptodb

@@ -77,18 +77,19 @@