KDB+ Overview


Advertisements

This is a complete quide to kdb+ from kx systems, aimed primarily at those learning independently. kdb+, introduced in 2003, is the new generation of the kdb database which is designed to capture, analyze, compare, and store data.

A kdb+ system contains the following two components −

  • KDB+ − the database (k database plus)

  • Q − the programming language for working with kdb+

Both kdb+ and q are written in k programming language (same as q but less readable).

Background

Kdb+/q originated as an obscure academic language but over the years, it has gradually improved its user friendliness.

  • APL (1964, A Programming Language)

  • A+ (1988, modified APL by Arthur Whitney)

  • K (1993, crisp version of A+, developed by A. Whitney)

  • Kdb (1998, in-memory column-based db)

  • Kdb+/q (2003, q language – more readable version of k)

Why and Where to Use KDB+

Why? − If you need a single solution for real-time data with analytics, then you should consider kdb+. Kdb+ stores database as ordinary native files, so it does not have any special needs regarding hardware and storage architecture. It is worth pointing out that the database is just a set of files, so your administrative work won’t be difficult.

Where to use KDB+? − It’s easy to count which investment banks are NOT using kdb+ as most of them are using currently or planning to switch from conventional databases to kdb+. As the volume of data is increasing day by day, we need a system that can handle huge volumes of data. KDB+ fulfills this requirement. KDB+ not only stores an enormous amount of data but also analyzes it in real time.

Getting Started

With this much of background, let us now set forth and learn how to set up an environment for KDB+. We will start with how to download and install KDB+.

Downloading & Installing KDB+

You can get the free 32-bit version of KDB+, with all the functionality of the 64- bit version from http://kx.com/software-download.php

Agree to the license agreement, select the operating system (available for all major operating system). For Windows operating system, the latest version is 3.2. Download the latest version. Once you unzip it, you will get the folder name “windows” and inside the windows folder, you will get another folder “q”. Copy the entire q folder onto your c:/ drive.

Open the Run terminal, type the location where you store the q folder; it will be like “c:/q/w32/q.exe”. Once you hit Enter, you will get a new console as follows −

KDB+ Console

On the first line, you can see the version number which is 3.2 and the release date as 2015.03.05

Directory Layout

The trial/free version is generally installed in directories,

For linux/Mac −

~/q       / main q directory (under the user’s home)
~/q/l32   / location of linux 32-bit executable
~/q/m32   / Location of mac 32-bit executable

For Windows −

c:/q          / Main q directory
c:/q/w32/     / Location of windows 32-bit executable

Example Files −

Once you download kdb+, the directory structure in the Windows platform would appear as follows −

KDB+ Example Files

In the above directory structure, trade.q and sp.q are the example files which we can use as a reference point.

Advertisements