TodayILearned
365 days of learning in public
One fullstack engineering concept every day โ taught deeply, then compressed into a public post. Day 1 was June 23, 2026.
Why does an index speed up a query?
And the part nobody mentions: when it actually makes things worse.
What is caching?
And when does it bite you?
Reading EXPLAIN output
How to see what the database is actually doing โ and whether your index is being used.
Contains Duplicate โ the hash set pattern
When 'have I seen this before?' is the question, a hash set is the answer.
Valid Anagram โ the frequency count pattern
When the question is 'how many times?', a hash map is the answer.
Composite indexes โ the leftmost prefix rule
When you index multiple columns, order matters. Here's why โ with a real benchmark.
Load balancing โ distributing traffic
One server can't handle it all. Here's how you spread the load โ and the tradeoffs of each strategy.
Connection pooling โ sharing database connections
Every database connection is expensive. A pool keeps a few warm and reuses them โ the load balancer's cousin, one layer deeper.
Rate limiting โ protecting your API
A load balancer distributes traffic. A rate limiter caps it. Here are the four algorithms and the tradeoff each one makes.
Transactions and ACID โ when all or nothing is the point
A connection pool gives you a connection. A transaction is what you do inside it โ a unit of work that either fully succeeds or fully fails.
Two Sum โ hash map complement lookup
The #1 most-asked LeetCode problem. One pass, one hash map, one key insight: for each number, check if you've already seen its complement.
Group anagrams โ sort key vs count key
Two ways to build a canonical key: sort each string (O(n ร k log k)) or count characters (O(n ร k)). The benchmark reveals a surprising crossover.
Database normalization โ 1NF, 2NF, 3NF
Three normal forms, three problems they solve. Normalization prevents anomalies; denormalization trades safety for speed.
Message queues โ when the request can't wait for the work
A load balancer distributes requests synchronously. A message queue decouples them asynchronously โ the producer fires and forgets, the consumer processes at its own pace.
JOINs โ when two tables become one
Normalization split your data into honest tables. JOINs stitch it back together โ at a cost. The planner picks the algorithm, but you control the indexes that make it fast.
API Gateway โ The Front Door
Load balancing distributes traffic. Rate limiting caps it. Caching skips work entirely. An API gateway does all three โ plus authentication, routing, and protocol translation โ at a single entry point. It's the composition layer where every previous lesson converges.
Keyset Pagination โ Why OFFSET Breaks at Scale
Your API returns page 500 in 50ms. Page 5000 takes half a second. Page 10000 takes two seconds. The user is just clicking 'next page' โ so why does each page get slower? The answer is OFFSET, and the fix is a cursor.
Top K Frequent Elements โ Heap vs Bucket Sort
Day 5 counted frequencies. Day 12 grouped by frequency. Today: find the top K. Three approaches, three Big O complexities โ and a benchmark that shows the textbook O(n) answer isn't always the fastest in practice.
Product of array except self โ prefix ร suffix
The no-division constraint forces a reframe: the answer for each position is the product of everything before it ร everything after it. Two passes, O(n) time, O(1) space.
Covering indexes โ when the index is enough
An index finds rows fast. A covering index returns the data too โ PostgreSQL skips the table entirely. Heap Fetches: 0 is the magic line in EXPLAIN.