Skip to content

JohnHop/useless_isam

Repository files navigation

Useless ISAM

This is a simple pet-project about a easy-understable minimal ISAM database.

It is composed by three separate executables.

If you are curious how is made I wrote a tutorial about it. Check it on GitHub Pages: https://johnhop.github.io/useless_isam/

csv2bin

Convert the dataset file from a .csv format a to binary file according to PAGE_SIZE value in params.h.

index-gen

Generate an index (binary) file from the binary file generated by the csv2bin executable. Furthermore, records are ordered by id to improve performance during retrieval of records.

isam

This is the database. Just use the index generated by index-gen and the binary file generated by csv2bin in order to read records selected by the user.

Usage

Parameters are hard-coded in params.h. They are

  • PAGE_SIZE (= 4096)
  • DATASET_FILENAME, location of the .csv dataset file
  • DATABASE_FILENAME
  • INDEX_FILENAME

Their values are set assuming that you will clone this repo and use cmake to build the executables.

First, execute csv2bin in order to obtain a binary file database.bin

$ > ./csv2bin

After, execute index-gen on database.bin in order to obtain the index.bin file

$ > ./index-gen

Finally, you can execute isam to querying the database.
Supported queries are single and range selection:

isam > SELECT [id]

or

isam > SELECT [start_id] - [end_id]

Examples

isam > SELECT 40047
40047, Gomishan, Iran. Islamic Rep. of

or

isam > SELECT 40000 - 50000
40047, Gomishan, Iran. Islamic Rep. of
41151, Pa'in-e Bazar-e Rudbar, Iran. Islamic Rep. of
41210, Khorramdarreh, Iran. Islamic Rep. of
41428, Padegan-e Manjil, Iran. Islamic Rep. of
44439, Kavar, Iran. Islamic Rep. of
49593, Yeed, Somalia
49747, Xuddur, Somalia

About

A small and simple ISAM database

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published