Startingkdbplus/introduction

From Kx Wiki
Jump to: navigation, search

Contents

1. Introduction

1.1 Overview

This is a quick start guide to kdb+ from Kx Systems, aimed primarily at those learning independently. It covers system installation, the q environment, q ipc, kdb+ tables and typical databases, and where to find more material. After completing this you should be able to follow the Borror tutorials Q for Mortals and Kdb+ For Mortals, and the wiki Reference and Cookbooks pages.

One caution: you can learn kdb+ reasonably well by independent study, but for serious evaluation of the product you need the help of a kdb+ consultant. This is because kdb+ is typically used for very demanding applications that require experience to set up properly. Contact Kx Systems or one of its partners for help with such evaluations.

1.2 Kdb+

The kdb+ system is both a database and a programming language:

kdb+ the database (k database plus).
q the programming language for working with kdb+

Both kdb+ and q are written in the k programming language. You do not need to know k to work with kdb+, but will occasionally see references to it. For example, q is defined in the distributed script q.k.

1.3 Resources

Kx wiki

The Kx wiki is the best resource for learning kdb+, and includes:

Kx Html Pages

Some older, but still useful, html pages are at kx.com/documentation.php. See in particular, Dennis Shasha's Kdb+ Database and Language Primer.

Other Material

Several background articles and links are given on the Articles page. For example, the Knowledge Base Kdb has a good overview.

Discussion groups

Additional Files

The kx.com/q directory has various supporting files, for example the script sp.q referenced in this guide (which is also included with the free 32-bit system). These files are also copied to the svn repository, so for example, the sp.q script can also be found at kx/kdb+/sp.q.

1.4 Install Free 32-bit System

If you do not already have access to a licensed copy of kdb+, then get the 32-bit version from here. This is a complete system and ideal for learning kdb+. It is limited only by being 32-bit.

When unzipping the install, take care to retain the folder structure.

1.5 Directory Layout

The free 32-bit system is usually installed in directories:

in 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

in Windows:

c:\q                   / main q directory
c:\q\w32               / location of windows 32-bit executable

It is best to install in these default directories. If you cannot do this, then define environment variable QHOME to point to the new q directory. Note that some of tutorial material assumes the default installation.

To run the system, see instructions in the next section, Q Language.

1.6 Example Files

Two sets of scripts are referenced in this guide:

1. The free 32-bit system is distributed with the following example scripts in the main directory:

If you do not have these scripts, get them from kx.com/q and save in your q directory.

2. Other example files are in the svn start directory. To get these, either

download with svn, e.g.

svn export http://code.kx.com/svn/cookbook_code/start

or browse to cookbook_code, then select the Download button on the start directory

Move the start directory under your q directory, i.e. q/start. For example, there should be a file:

c:\q\start\buildhdb.q         / windows
~/q/start/buildhdb.q          / linux and mac

Windows users: since q source is in plain text files, it is worthwhile installing a good text editor such as notepad++ or notepad2.

1.7 GUI

When kdb+ is run, it displays a console where you can enter commands and see the results. This is all you need to follow the tutorial, and if you just want to learn a little about kdb+, then it is easiest to work in the console.

As you become more familiar with kdb+, you may try one of the GUIs:


Prev: Table of Contents Next: 2. Q Language

Table of Contents

Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox