Performance
508 bites tagged Performance — interview questions with model answers, and 60-second explainers.
Connection pools and the problem they solve
A pool reuses pre-opened connections so requests skip the expensive connect handshake; without one, every request pays setup latency and may overwhelm the database. connection reuse basics.
Connection pooling and its key parameters
Reuse open connections to skip costly handshakes; tune max pool size and connection timeout. pooling tradeoffs. setting max size huge, exhausting database connections, or treating the pool as free.
How does columnar storage speed up analytics?
Columnar stores each column contiguously, so aggregations read only needed columns, scan far less data, and compress better with vectorized execution. physical storage layout versus query type.
How does a hash join handle memory overflow?
The build table is partitioned by hash and spilled to disk, then probe rows are partitioned the same way, and pairs are joined per partition. understanding of query execution under memory pressure.
Why developers read query plans
The plan shows the operators the optimizer chose to run a query; developers read it to find why a query is slow; a common thing to look for is a full table scan where an index was expected. basic EXPLAIN literacy.
Trade-offs of adding indexes to a table
Indexes speed reads but slow writes since every INSERT, UPDATE, and DELETE must maintain them; they consume storage and can be unused on low-selectivity columns. understanding indexes cost more than they give.
What is a query execution plan?
The plan is the optimizer's chosen tree of operators; run EXPLAIN or EXPLAIN ANALYZE; watch for sequential scans, bad row estimates, and costly joins. practical query debugging. confusing estimated cost with actual time.
Clustered versus non-clustered indexes
A clustered index orders the table's actual rows, one per table; a non-clustered index is a separate structure pointing to rows. how index type affects physical row storage. thinking a table can have many clustered indexes.
What a database index is and when it helps
An index is a sorted lookup structure avoiding full scans, helps selective WHERE/JOIN columns, but costs write overhead. basic indexing intuition. indexing everything or ignoring the write and storage cost.
Adjacency List versus Nested Set for hierarchies
Adjacency list is simple writes but recursive reads; nested set is fast subtree reads but costly writes. read-versus-write trade-offs in tree storage. ignoring recursive CTEs or the wide updates nested sets need.
When to intentionally denormalize a schema
Identify read-heavy join cost, duplicate or precompute data, and own the consistency burden. trading read speed for write complexity deliberately. denormalizing prematurely or ignoring how duplicates drift.
Diagnosing and fixing the N+1 query problem
Define the 1 parent plus N child queries, fix via JOIN or batched IN, and ORM eager loading. spotting hidden per-row queries from lazy loading. solving it only with caching while ignoring round-trip count.
pandas .apply() versus vectorized operations
Apply runs a Python function per row or column, flexible but slow due to per-element looping; prefer vectorized ops; use apply only for custom logic with no vectorized equivalent. pandas performance literacy.
Performance concerns with the :has() selector
:has() forces upward and forward style invalidation on DOM changes, broad subjects are costly; mitigate by scoping the subject, avoiding deep or universal arguments, and limiting dynamic… understanding of selector matching cost.
Bundling a component library for tree-shaking
Ship ES modules, mark sideEffects false, preserve named exports, and externalize peers so consumers tree-shake and code-split. Optimizing a library so consumers ship less code.
CSS Modules versus Styled Components
CSS Modules scope via build-time hashed class names with near-zero runtime; Styled Components scope via runtime CSS-in-JS with easy dynamics but a runtime cost. CSS scoping tradeoffs. claiming one is strictly best.
Diagnose and shrink a large CSS bundle
Purge unused selectors, minify and merge with cssnano, split critical CSS and code-split per route. practical CSS size reduction. only minifying while shipping dead rules and deeply nested Sass.
What are CSS variable fonts?
One file encodes a continuous range along axes, cutting requests and bytes, controlled via font-weight, font-style, and font-variation-settings. modern web typography and performance.
Diagnosing slow auto-scaled PaaS workloads
Application metrics like request latency, throughput, and DB query time; infrastructure metrics like CPU, memory, and scaling lag. layered debugging under load. jumping to add instances without isolating the real bottleneck.
When to choose bare metal over a VM
Bare metal suits latency-sensitive or high-throughput workloads needing no hypervisor overhead, single-tenant isolation for compliance, or direct hardware and licensing access. hardware-level trade-offs.
Inference performance bottlenecks on Lambda
Cold starts loading the model, memory and CPU limits, no GPU, and package size dominate; mitigate with provisioned concurrency, loading the model once outside the handler, smaller models, and right-sized… serverless ML serving limits.
The small files problem in data lakes
Too many tiny files inflate metadata and per-file overhead, slowing queries; caused by streaming micro-batches and over-partitioning; fix with compaction and table formats like Iceberg, Delta, or Hudi. lake performance pathology.
Diagnosing and fixing data skew in Spark
This is data skew, caused by uneven key distribution concentrating rows on few partitions; mitigate with salting, broadcast joins, repartitioning, or adaptive execution. distributed processing skew. just adding more executors.
Diagnose 100% CPU on a managed database
Correlate the spike with deploys and traffic, find top queries via the engine's views, inspect plans for missing indexes, then tune before scaling. structured DB triage. scaling up without finding the offending query.
Get Performance bites daily.
Five a day, five minutes, offline. With quizzes so it sticks.
Open testing — you’ll join as an early tester.