1. Introduction

1.1 Overview

This is a quick start guide to q, aimed primarily at those learning independently. It covers system installation, the q environment, IPC, tables and typical databases, and where to find more material. After completing this you should be able to follow the Borror textbook Q for Mortals, and the wiki Reference and Cookbook.

One caution: you can learn q reasonably well by independent study, but for serious evaluation of the product you need the help of a consultant. This is because q 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


This site is the best resource for learning q, and includes:


Other material

Several background articles and links can be found in the Archive. For example, the Thalesians’ Knowledge Base Kdb has a good overview.

Discussion groups

  • The main discussion forum is the k4 listbox. This is available only to licensed customers – please use a work email address to apply for access.
  • The Kdb+ Personal Developers forum is an open Google discussion group for users of the free 32-bit system.

1.4 Install free 32-bit system

If you do not already have access to a licensed copy, go to Get started to download and install q.

1.5 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:

    • sp.q – the Suppliers and Parts sample database
    • trade.q – a stock trades sample database

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

  2. Other example files are in the KxSystems/cookbook/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 macOS

Text editor for Windows

Since q source is in plain text files, it is worthwhile installing a good text editor such as Notepad++ or Notepad2.

1.6 GUI

When q 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 q, then it is easiest to work in the console.

As you become more familiar with q, you may try one of the GUIs.