KDB/Q Pre-School: Your first Baby Steps
When it comes to KDB/Q, there are core fundamentals that everyone should understand, regardless of their role or level of involvement in development work. Gaining this foundational knowledge can help you to make more informed decisions, ultimately contributing to your success. In the following section, I’ll highlight these key concepts, explain why they’re essential, and provide a study plan to help you acquire this knowledge.
In the following section, I’ll cover the foundational knowledge that anyone working even remotely with KDB/Q should have. I’ll also include resources and guidance for diving deeper into each topic. If you’ve been following me for a while, you’ll know that I’m a huge advocate of Q for Mortals - one of my top two favorite books on KDB/Q. If you’re new here, here’s why: I believe Q for Mortals is the best starting point for learning KDB/Q, and I highly recommend everyone read it at least once, cover to cover. That said, I understand time is precious, so I’ll focus on the key sections to help you get started quickly. Let’s dive in!
You can buy a hardcopy of Q for Mortals or you can find a free, online edition here: Q for Mortals, free online edition
KDB/Q Reference Card
A website you'll want to keep open while studying KDB/Q is the KDB/Q Reference Card on code.kx.com. It's an invaluable tool for quickly looking up keywords, operators or KDB/Q concepts. Personally, it's the one tab I always have open in my browser, ready for a quick double-check whenever I need it. I recommend you do the same.
Note: Going forward I will abreviate "Q for Mortals" with Q4M
Array Programming vs Object Oriented Programming
Learning objective: Understand the difference between array/vector/functional programming languages and object-oriented programming languages.
History of KBD/Q
- Chapter 0: Overview, Section 0.0 The Evolution of Q, Q4M
- KDB/Q Unveiled: A Journey into the Pinnacle of Database Technology, DefconQ
- You can find a detailed history of KDB/Q on the Thalesians blog's wiki page here, Thalesians
Learning objective: The History of KDB/Q and what influenced Arthur Whitney
How to install KDB/Q
A crucial part of learning KDB/Q—or any new skill, really—is diving in and getting hands-on as soon as possible. If you haven’t already, take a moment to install KDB/Q on your laptop. If you’re in an enterprise setting, consider reaching out to your KDB/Q team to request access to a standalone process for testing or a local instance to practice on.
Learning objective: Installing KDB/Q and starting a Q
process
The Fundamentals of the KDB/Q programming language
The foundational elements of the KDB/Q language are its Data Types: Atoms, Lists, Dictionaries, and Tables. A solid grasp of these data types is essential for understanding the language. The following chapters in Q for Mortals cover these concepts in detail. I’ll highlight the necessary sections, leaving the optional ones for you to explore at your own pace.
I'll outline three progressively challenging levels to guide you on your ascent of the KDB/Q Olympus, aiming to reach the top and, ultimately, the Q-Gods by the end of your journey. It’s up to you to decide how far you want to go and when to pause along the way.
- Chapter 2: Basic Data Types - Atoms
- Base Camp: 2.0 Overview
- Acclimatisation: Quickly skim through the entire chapter, capturing the key concepts.
- Summit: Read the chapter in depth to fully understand the behaviors and intricacies of KDB/Q, practicing exercises in the KDB/Q console as you go.
- Chapter 3: Lists
- Base Camp:
- Acclimatisation: Quickly skim through the entire chapter, capturing the key concepts.
- Summit: Read the chapter in depth to fully understand the behaviors and intricacies of KDB/Q, practicing exercises in the KDB/Q console as you go.
- Chapter 4: Operators
- Base Camp:
- Acclimatisation: Quickly skim through the entire chapter, capturing the key concepts.
- Summit: Read the chapter in depth to fully understand the behaviors and intricacies of KDB/Q, practicing exercises in the KDB/Q console as you go.
- Chapter 5: Dictionaries
- Base Camp:
- Acclimatisation: Quickly skim through the entire chapter, capturing the key concepts.
- Summit:
- Read the chapter in depth to fully understand the behaviors and intricacies of KDB/Q, practicing exercises in the KDB/Q console as you go
- Read Dictionaries on DefconQ
- Chapter 6: Functions
- Base Camp:
- Acclimatisation: Quickly skim through the entire chapter, capturing the key concepts.
- Summit: Read the chapter in depth to fully understand the behaviors and intricacies of KDB/Q, practicing exercises in the KDB/Q console as you go.
- Chapter 8: Tables
- Base Camp:
- Acclimatisation: Quickly skim through the entire chapter, capturing the key concepts.
- Summit:
- Chapter 9: Queries - Q-SQL
- Base Camp:
- Acclimatisation: Quickly skim through the entire chapter, capturing the key concepts.
- Summit:
- Read the chapter in depth to fully understand the behaviors and intricacies of KDB/Q, practicing exercises in the KDB/Q console as you go
- Read QSQL - Querying Your Data on DefconQ
The material above provides a comprehensive overview of the essential KDB/Q concepts. I find Q for Mortals to be an enjoyable read, and tackling one chapter per day should enable you to cover everything mentioned within one to two work weeks. Alternatively, if you prefer a more visual or classroom-based approach, you can achieve similar results by completing the KDB/Q Developer Level 2 Course on KX Academy.
Learning objective: This section will equip you with the fundamentals of the KDB/Q programming language. By the end, you'll have a solid grasp of KDB/Q's data types, how to work with them, and how to write functions. You'll understand that dictionaries and tables are first-class citizens and that, at its core, everything is a map. You'll also gain skills in querying data, building a strong foundation in KDB/Q.
KDB/Q: One of a Kind
KDB/Q is fundamentally different to anything else you will have encountered so far, especially when it comes to mainstream, object-oriented programming languages such as Java, C++ or Python. Recognising these differences and their impact is crucial for effectively working with KDB/Q. I've outlined the key paradigms and their implications in my blog post here: The Magnificent Seven - Mastering KDB/Q Concepts for Data Excellence
Learning objective: Understanding fundamental concepts and paradigms of the KDB/Q programming language
Tick Architecture - The Plain Vanilla KDB/Q Architecture
Mastering the KDB/Q programming language is only part of harnessing its full potential. To deepen your expertise, it’s essential to understand how KDB/Q is applied to build enterprise solutions, especially in the creation of KDB/Q Tick platforms. For decades, KDB/Q has been the go-to technology for big data and time-series analysis, driving the data platforms of major investment banks and hedge funds. A typical KDB/Q data pipeline includes a data source, feedhandler (FH), ticker plant (TP), real-time database (RDB), and historical database (HDB). You can find a comprehensive introduction to a typical KDB/Q platform on my blog here: The Plain Vanilla Tick Setup
Again, if you're more of a visual learner, you can complement the reading above with the KDB+ Architecture Course on KX Academy.
Learning objective: Understanding the basic setup of a plain vanilla KDB/Q Tick Architecture
Unmatched Power
KDB/Q has long been the top choice for building big data platforms in the financial industry, with all major investment banks and hedge funds well aware of its power and capabilities. If you want to fully understand what makes KDB/Q so powerful and high-performing, check out my two blog posts below:
- Unmatched Performance: The Speed Secrets of KDB/Q
- The Power of Time-Series Analysis and Big Data: Why KDB/Q Reigns Supreme
Learning objectives: Understand why KDB/Q is the go-to technology for building big data platforms
Bonus
Finally, I have a little treat for you! Since KDB/Q syntax can be quite different from anything else you may have encountered, beginners often find it challenging to read and interpret others' code. To help you overcome this initial hurdle, I’ve written a blog post on How to Read, Understand, and Learn KDB/Q Code. Check it out here to get some useful insights!
This concludes our basic study plan. By covering everything above, you should now have a solid foundation to build more advanced skills in KDB/Q. Based on your goals, you can now dive into the dedicated, in-depth study plan for: