What is ASSERTION in KDBS?
SQL-92 defined CREATE ASSERTION; most databases never impelented.
It is a constraint for a group - a combination of columns in a relation - defined by an expression.
Assertion forces a group to keep the result of count, min, max below a limit.
Features Beyond the Basics
1. Assertions: declare invariants that the database verifies.
2. Transitions (WIP): define a chain of allowed state transitions for a field of a relation.
3. Query-pattern-bound statistics (In-design): track each query’s fingerprint, collect statistics per fingerprint, and use them to optimize the physical data layout.
4. Dynamic partial indexes: indexes that are built and adjusted dynamically for the rows that queries actually touch.
5. Loose constraints (In-design) : rather than rejecting a violation outright, a loose constraint issues a warning and lets the change proceed.
KDBS imposes invariants on itself. Paradoxically, these self-imposed constraints make it more flexible.
The invariants are as follows.
1. A tuple`s identity key (primary key) is immutable.
2. Every tuple in a relation has the same fixed size.
3. no query plan opt.
4. Int64 key.
What KDBS Keeps
1. Index: KDBS support secondary index including covering, unique index.
2. Foreign key: Reference checks stay fast, and a reference never becomes stale because of a key update.
3. Sub-query: With no cost-based planner, a sub-query follows the same execution path every time. Its behavior and latency are predictable.
4. MVCC & write-ahead logging (WAL): Fixed-size tuples and in-place updates keep undo records compact. Version chains stay short, and recovery paths stay simple.
5. Backup & recovery: Fixed-size tuples and a regular page layout make snapshots and log replay straightforward, so recovery is fast and reliable.
6. CDC (In-design): Downstream consumers can apply changes in order without key remapping.
What KDBS Intentionally Leaves Out
1. Procedures and triggers: KDBS does not support stored procedures or triggers. Instead, it encourages users to write queries as short transactions, and multi-step business logic should live on the application side. Short transactions hold locks and undo records for less time, which keeps latency predictable and MVCC version chains short.
2. CTE: KDBS does not support common table expressions (CTEs). It encourages users to keep transactions short and logically atomic. Without a cost-based planner, every query follows a single deterministic execution path, and composing multi-step logic is left to the application.
3. Sub-transaction: KDBS does not support sub-transactions. Each transaction is a single, flat unit of work, which keeps the undo and recovery paths simple and makes the outcome of a failure easy to reason about.
What Invariants Provide
1. Updates happen in place, so tuples rarely migrate between pages, there is no need to vacumm page.
2. Stable tuple locations let CKDBS collect statistics on query access patterns and optimize the index layout accordingly.
3. It helps to maintain a high rate of cache hit.
4. KDBS does not use cost-based query planning. Every query executes deterministically.
144K Followers 2K FollowingTruth-seeker. On a mission to drive cost of living to zero. Founder @ Lookout, Investor @ SNR (11x🦄). Believer in founding ideals of 🇺🇸
289K Followers 459 FollowingCo-Founder & General Partner A*. Co-founder of Sauron, Eventbrite (IPO 2018, acquired by Bending Spoons), and Xoom (IPO 2013, acquired by PayPal)
1.1M Followers 690 FollowingCo-Founder, LinkedIn. Investor. MSFT Board Member. Building an LLM to discover cures for cancer: @manas_co. Most importantly: Proud American.
628K Followers 2K FollowingFrom the bottom to the top & back again. Co-founded @twitch, now working on making videos, https://t.co/J6efUJZmLI https://t.co/4hyHeP7oIB
1.1M Followers 6K FollowingPresident & CEO @ycombinator —Founder @garryslist—Creator of GStack & GBrain—designer/engineer who helps founders—SF Dem accelerating the boom loop