Introduction to kdb+
2019-06-28
Chapter 1 Getting Started
1.1 kdb+
Kdb+ Fundamentals is an introductory kdb+ course perfect for learning about kdb+ and the principles of vector programming. This three-day training course is ideal for those with limited or zero experience with kdb+. By the end of this kdb+ training course you will be fully able to use kdb+ to manage data from multiple data sources and interact with both in-memory and on-disk kdb+ installations.
- Reference website: http://code.kx.com
- k database plus
- High performance database, managing real time and historical data within a single platform
- Features:
- Column orientated
- Embedded query language - q
- In-memory and on-disk data access
- Optimized and configurable partitioning of on-disk data
- 64-bit architecture with built-in multi-threaded support
- Direct analysis on data
- High speed time series analysis
- Discrete and continuous joins
1.2 kdb+ Windows Intallation
- http://kx.com/software-download.php
- Download the free trial version of kdb+ for Windows
- Unzip the file and put the q folder in C drive
- The default home directory of q (QHOME) is c:nq, and the q executable is in c:nqnw32.
- This can be added to the path.
- If you wish to store q in a different directory and run it, you need to add the QHOME environment variable. To run q without referencing the full path, it should be added to the path variable
- Go to Start, right click on Computer, click Properties
- Click Advanced System Settings then Environment Variables
- To edit the path:
- In System Variables, select path and click edit
- Add c:nqnw32 at the start of the path definition
- To edit QHOME (if not stored in c:nq):
- Add QHOME as either as either a System Variable (for all users) or User Variable (for the current user only)
- Set it to c:nq (or wherever q is installed)
- Open a command prompt and type q to start a q session
1.3 kdb+ Unix Installation
- On unix platforms (OSX, Linux, Solaris) the default location of q is ∼/q (where ∼ is the current users home directory)
- Similarly to windows, if you want to run q from a different location you should create a QHOME environment variable. If you wish to make q accessible just by typing q, it needs to be on the path
- To create the environment variable, do export QHOME=∼/q
- To set the path, do export PATH=∼/q/m32:$PATH. m32 should be replaced with the specific directory for the required OS
- These commands will only have effect for the current session. To set them permanently,or for all uses, they should be set in a profile script which is sourced at session start up
- To run q, type q
- It is a good idea to install and use rlwrap when running kdb+ on unix