Articles

Ai Architecture ๐Ÿ‡บ๐Ÿ‡ธ

Standard of Iron runs one strategic AI instance per computer-controlled owner. The AI is deliberately separated from the live ECS world: the world-owning thread builds an immutable snapshot, worker code reasons from that snapshot, the result is converted into typed AI commands, command conflicts are...

Hill Shapes ๐Ÿ‡บ๐Ÿ‡ธ

A terrain entry of type hill uses its shape field to define the tactical footprint of raised ground. Maps can author organic mounds, straight ridges, arcs, elbows, rings, traced paths, or exact painted cell masks...

Performance ๐Ÿ‡บ๐Ÿ‡ธ

How the game is profiled, what was found on the heaviest mission, and why the hot paths look the way they do. Source files carry no comments (the formatter strips them), so the reasoning behind each optimisation lives here...

Quizes ๐Ÿ‡บ๐Ÿ‡ธ

Try answering each question before opening its answer. SQL exercises identify their dialect; syntax and guarantees vary between engines...

Transactions Intro ๐Ÿ‡บ๐Ÿ‡ธ

A bookstore checkout changes several facts: stock decreases, an order is created, and the purchased items are recorded. Those changes belong together. An order without its items is incomplete; a stock reduction without an order loses inventory...

Consistency ๐Ÿ‡บ๐Ÿ‡ธ

In ACID, consistency means that correct transactions take the database from a valid state to another valid state. A valid state satisfies the system's required rules. The database enforces declared constraints; the application must correctly implement rules that are not fully expressed by those cons...

Durability ๐Ÿ‡บ๐Ÿ‡ธ

Durability means that a successfully committed transaction survives the failures covered by the database's configuration and storage assumptions. It is the reason an application can rely on a successful commit acknowledgment after a crash. It does not promise survival after every durable copy is des...

Atomicity ๐Ÿ‡บ๐Ÿ‡ธ

Atomicity means that a transaction's changes are committed as one unit. If the transaction is rolled back, none of those changes remain committed. The operations still execute one after another; atomicity does not mean they take place at the same instant...

Indexing ๐Ÿ‡บ๐Ÿ‡ธ

An index is an additional access path to data. It can reduce the rows and pages examined by a query, but it also consumes storage and must be maintained when indexed data changes. Start with the queries you need to support, then verify the resulting plans...

Primary Key vs Secondary Key ๐Ÿ‡บ๐Ÿ‡ธ

A key expresses an identification rule. An index is a physical access structure. The two are related because engines often use indexes to enforce keys, but they are not interchangeable...

Query Optimization Techniques ๐Ÿ‡บ๐Ÿ‡ธ

A query can return the correct result and still do far more work than necessary. Optimization means reducing that work while preserving the result the application needs. Start with one measured problem, not a checklist of indexes to add everywhere...

Working with Billion Row Table ๐Ÿ‡บ๐Ÿ‡ธ

A billion rows is not a magic threshold at which one architecture becomes mandatory. A narrow, well-indexed billion-row table with selective queries can be easier to operate than a much smaller table with wide rows, poor access patterns, heavy churn, or global scans. Start from data size, row width...

Indexing Strategies ๐Ÿ‡บ๐Ÿ‡ธ

Index access methods suit different operations. This note compares B-tree, bitmap, hash, and full-text indexes using named engines. For composite index design, covering queries, and maintenance, see Database Indexing...

Introduction to Orm ๐Ÿ‡บ๐Ÿ‡ธ

An object-relational mapper (ORM) is a library that maps application objects to relational tables and generates SQL for common database operations...

Popular Orm Tools ๐Ÿ‡บ๐Ÿ‡ธ

ORMs solve similar problems, but they expose very different programming models. Some are tightly integrated with a web framework, some implement a language ecosystem standard, and some deliberately stay close to SQL...

Relationship Loading and Query Performance ๐Ÿ‡บ๐Ÿ‡ธ

ORM performance problems usually come from the SQL workload generated by application code: too many round trips, too many rows, large joins, missing indexes, or transactions that stay open too long...

Transactions Concurrency and Unit of Work ๐Ÿ‡บ๐Ÿ‡ธ

ORMs make database access convenient, but concurrent requests still operate on a shared database. Two application workers can read the same row, make different decisions, and attempt conflicting writes...

Deadlocks ๐Ÿ‡บ๐Ÿ‡ธ

A deadlock occurs when two or more transactions are waiting for one another in a cycle and none can continue unless one of the transactions is aborted or otherwise forced to release its resources...

Serializable vs Repeatable Read ๐Ÿ‡บ๐Ÿ‡ธ

Imagine two requests hit an application at almost exactly the same time...

Shared vs Exclusive Locks ๐Ÿ‡บ๐Ÿ‡ธ

Locks coordinate concurrent access to database resources...

Two Phase Locking ๐Ÿ‡บ๐Ÿ‡ธ

Two-Phase Locking, usually abbreviated 2PL, is a concurrency-control protocol for making interleaved transactions behave like some serial execution...

Data Control Language Dcl ๐Ÿ‡บ๐Ÿ‡ธ

Data Control Language (DCL) manages database privileges through statements such as GRANT and REVOKE. A privilege is permission to perform a particular operation on a particular resource...

Intro to Sql ๐Ÿ‡บ๐Ÿ‡ธ

SQL, or Structured Query Language, lets you describe the data you want or the change you want to make. For example, โ€œshow Alice's ordersโ€ becomes a SELECT query; โ€œrecord a new customerโ€ becomes an INSERT statement...

Data Manipulation Language Dml ๐Ÿ‡บ๐Ÿ‡ธ

Data Manipulation Language (DML) works with table data. SELECT reads rows, INSERT adds them, UPDATE changes them, and DELETE removes them. The table's structure remains in place unless a separate schema-changing command alters it...

Aggregate Functions ๐Ÿ‡บ๐Ÿ‡ธ

An aggregate calculates one result from several rows. SUM adds values, COUNT counts them, and AVG calculates their average. Without grouping, one aggregate can summarize the whole input. With GROUP BY, it summarizes each group separately...

Data Definition Language Ddl ๐Ÿ‡บ๐Ÿ‡ธ

Data Definition Language (DDL) defines database objects. A table definition says which columns exist, what kinds of values they accept, and which rules apply. It is different from inserting the current rows into that table...

Transaction Control Language Tcl ๐Ÿ‡บ๐Ÿ‡ธ

A checkout involves more than one write. The bookstore must record an order, record its lines, and reduce stock. If an application stops between those operations, a partially recorded purchase can be misleading...

Triggers ๐Ÿ‡บ๐Ÿ‡ธ

A trigger is database logic invoked automatically by a specified event. Unlike a procedure, which a caller explicitly invokes, a trigger can run because an application inserts, updates, or deletes rows...

Stored Procedures and Functions ๐Ÿ‡บ๐Ÿ‡ธ

A view names a query. A stored routine names database code that can accept inputs and perform work. Two common kinds are procedures and functions. Their syntax, return values, transaction rules, and privileges depend on the engine...

Window Functions ๐Ÿ‡บ๐Ÿ‡ธ

A window function calculates a value across rows related to the current row while retaining those rows in the result. Use it for rankings, running totals, and comparisons with earlier or later rows. OVER defines the partition, order, and, where applicable, frame...

Hierarchical Data ๐Ÿ‡บ๐Ÿ‡ธ

A bookstore's categories form a hierarchy: Books contains Computing, and Computing contains Databases and Programming. A tree represents that structure using nodes and parentโ€“child relationships. A root has no parent. A leaf has no children. A node's descendants are its children, their children, and...

Joins Subqueries and Views ๐Ÿ‡บ๐Ÿ‡ธ

The bookstore's tables separate customers, orders, products, and order lines. A query puts the relevant facts together without permanently copying them. This note explains three tools: a join combines matching rows, a subquery uses another query inside a statement, and a view names a reusable query...

Sqlite ๐Ÿ‡บ๐Ÿ‡ธ

SQLite is a self-contained, serverless, and zero-configuration SQL database engine that's known for its simplicity and efficiency. Unlike traditional databases that require a separate server to operate, SQLite operates directly on ordinary disk files. This makes it an ideal choice for small to mediu...

Clickhouse ๐Ÿ‡บ๐Ÿ‡ธ

ClickHouse is a column-oriented SQL database designed for analytical workloads over large datasets. It is commonly used for...

Postgresql ๐Ÿ‡บ๐Ÿ‡ธ

PostgreSQL is an open-source object-relational database maintained by the PostgreSQL Global Development Group. It supports relational queries, extensible types, and transactions for a wide range of applications...