Table Types

BangDB Supports different types of tables for different purposes. This is mainly to allow user to use the type easily suitable for a particular scenario. Need for different table types is driven solely from the usage point of view.

When we need to store key and value with value of variable size and we wish to access data always through the key then normal table is useful. Normal table typically creates idx and dat file for Btree and for hash an extra .dir file. For normal table key can be stored using btree or hash. Thus index on primary key is always created for normal table(this is infact true for all types of tables)

When we wish to deal with int or long types of data then it is always efficient to use primitive table as it avoids creating extra files and hence uses resource lot more efficiently which finally improves the performance as well. The key type here again can be of fixed size string ot int/long type> here again secondary indexes are not allowed (or necessary), the primary key is stored using either btree or hash as defined by the user

Finally, the wide table is useful when we have structured data or we wish to access opaque data with some other handle as well. Json data is supported with BangDB and user may specify as many indexes on as many fields as required. Nested index can also be created. BangDB then takes care of secondary indexes when data is added. Later data can be accessed through secondary indexes or primary indexes using the appropriate APIs. For secondary indexes, currently with 1.5 only btree is supported. To retrieve data user may do scan over the documents using index(es) and db would return multiple resultsets (for as many scans), user then may perform different operations on resultsets to further filter the data

Following are the highlights of Multi Table Types - Normal Table, Wide Table, Primitive Table

  • Normal Table - key value store with value as opaque entity. Key can be string or opaque and value may again be string or opaque. In earlier version only this type of table was supported.
  • Wide Table - Here value can be bit structured which means that db can do bit more than just storing the value. Currently data can be simple or json string. which means user would be able to create index. For string data, user should specify the substring on which index can be created and for json data user may create index on different fields (nested as well) and db would then accordingly store the data. This allows user to create various indexes for better and efficient data retrieval. In next release column family would also be supported here where user may create different columns and store them as value
  • Primitive Table - This is special table type mainly to address particular set of use case where value is of fixed size. Note that BangDB asks for key size upfront hence size of it is always fixed (or variable length but less than the supplied max key size). But value could be of variable length and hence different ways are required to store the value. But when user wishes to store int or long or datatime or string with constant size then it would be much efficient to treat these values differently for less resource consumption and better performance. Primitive table comes handy in these case as user can just create table suitable for the value data type

Look at the next section for more details