Documentation
¶
Overview ¶
Package dblab is DBLab, the data tier of a shop: PostgreSQL tables for customers, products and orders, seeded into a database you give it, and an in-process Redis (miniredis) with a product cache and a popularity ranking. The databases pack runs its queries and commands straight against both; DBLab's own HTTP side only reports health and counts. It is the reference app for the databases pack.
Planted bottlenecks (see README.md), each switched off by a fix flag:
- index: orders has no index on customer_id, so a customer's order history scans the whole table (fix "index" adds one on (customer_id, created_at)).
- hotrow: a trigger adds every new order to one running-totals row, so concurrent checkouts queue on that row's lock until each commits (fix "hotrow" spreads the totals over 16 rows by order id).
Index ¶
Constants ¶
View Source
const Schema = "dblab"
Schema is where DBLab's tables live; it is dropped and recreated on every start.
Variables ¶
This section is empty.
Functions ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.