Computer Engineering is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

Parallel databases: speed-up and parallelism

Notes on speed-up, efficiency and scalability in parallel databases: Amdahl's and Gustafson's laws, cost and iso-efficiency, communication costs and common exam questions.

Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

Parallel databases split work across processors or machines to answer queries faster and handle larger data. An engineer uses these concepts to predict performance, choose the number of processors, decide whether to scale problem size or resources, and to design cost-effective, scalable query plans and architectures.

Key ideas

  • Scale-up (DBMS): increase both data size and resources by a factor of n and aim to keep response time constant. Two variants often examined: batch scale-up (n× data on n× resources has about the same elapsed time) and transactional scale-up (n× users and n× data on n× resources yields about the same per-transaction response time, i.e., throughput scales). Always state which notion you use.

  • Parallel efficiency (E(n)): fraction of ideal speed-up achieved, E(n) = S(n)/n. If E = 1 then we achieve linear speed-up.

  • Serial fraction / parallel fraction: Let f_s be the fraction of execution time that is inherently sequential (cannot be parallelised). Let f_p = 1 - f_s be the parallelisable fraction. These are dimensionless fractions measured relative to total work for a chosen base problem size.

  • Amdahl's law (exact statement): If fraction f_s of the total work is strictly serial and the remaining f_p = 1 - f_s is perfectly parallelisable, then the maximum speed-up with n processors is S(n) = 1 / [ f_s + (f_p / n) ]. Assumptions: fixed total problem size; parallel part divides evenly and has zero extra overhead (no communication or load imbalance). Universities commonly ask to derive this from times: T1 = f_s·T1 + f_p·T1, Tn = f_s·T1 + (f_p·T1)/n, so S = T1/Tn.

    Diagram to draw for exam: draw a timeline rectangle for T1 divided into two parts: serial (left) and parallel (right) labelled f_s·T1 and f_p·T1. Next to it, draw n horizontal timelines (processors) showing the serial part executed sequentially on one processor, then the parallel part split across processors; label total Tn under these timelines.

  • Gustafson's law (exact statement): For scaled problems (problem size grows with number of processors so parallel work increases), if on n processors the serial fraction is s (fraction of the observed runtime on n processors) and the parallel fraction is p = 1 - s, then the scaled speed-up compared to a single-processor run of the same scaled problem is S(n) = s + p·n = n - (n - 1)·s. Assumptions: we treat runtime on n processors as fixed and increase total work such that parallel portion grows; serial part remains constant. Derivation: normalize Tn = 1 = s + p; the equivalent single-processor time for the same scaled workload is T1 = s + n·p, so S(n) = T1/Tn = s + n·p = n - (n - 1)·s.

  • Superlinear speed-up: observed S(n) > n. It violates naive assumption of perfect scaling but can occur in practice due to cache effects, reduced I/O, or algorithmic changes on parallel decomposition. When reporting, explain cause.

  • Cost and cost-optimality: Cost(n) = n·Tn (total processor-seconds). A parallel algorithm is cost-optimal if Cost(n) = Θ(T1) (i.e., cost proportional to best serial time). Universities ask: cost-optimality ensures no waste of total work.

  • Communication cost model (α–β model): time to send a message of m bytes is α + β·m, where α is latency (start-up time, in seconds) and β is per-byte transfer time (s per byte, reciprocal of bandwidth). Use this to include realistic overhead in performance predictions.

  • Communication overhead and granularity: communication overhead is extra time spent in moving data and synchronising. Granularity describes the size of parallel tasks: coarse-grained tasks have relatively large computation compared to communication (good for efficiency); fine-grained tasks communicate frequently (bad for efficiency).

  • Types of parallelism in DBMS: inter-query (execute multiple independent queries concurrently), inter-operator or pipelined (overlap different operators within a query), and intra-operator or partitioned (split a single operator—scan/join/aggregate—across data partitions). Be ready to illustrate on a query plan tree.

  • Iso-efficiency function: relation between problem size W and processor count n that keeps efficiency constant. If T_o(W,n) is total parallel overhead, then for target efficiency E we require W = (E/(1 - E))·T_o(W,n). This gives how fast the problem size must grow to keep efficiency fixed as n increases.

  • Practical assumptions often violated in real systems: uniform partitioning, zero communication, identical processors, no I/O bottlenecks, and no skew in data distribution. When writing answers, state which assumption you relax.

Formulas

S(n) = T1 / Tn — S(n) is speed-up with n processors; T1 is execution time on 1 processor (s); Tn is execution time on n processors (s). Applies always by definition.

S(n) = 1 / ( f_s + (1 - f_s)/n ) — Amdahl's law. f_s is serial fraction (unitless), n is number of processors. Applies for fixed-size problems and ideal parallelisation of f_p.

E(n) = S(n) / n — Parallel efficiency (unitless). Applies always.

S(n) = s + p·n = n - (n - 1)·s — Gustafson's law for scaled problems. s is serial fraction measured on n-processor run (unitless), p = 1 - s.

Cost(n) = n · Tn — Total processor-time cost (processor·s). Cost-optimal if Cost(n) = Θ(T1).

T_comm(m) = α + β·m — Simple message cost; m in bytes, α in seconds (latency), β in seconds per byte. Applies for point-to-point messages in many models.

E = 1 / (1 + T_o / W) — Efficiency in terms of total overhead T_o (s) and useful work W (s). Rearranged: W = (E/(1 - E)) · T_o for fixed efficiency.

Worked examples

  1. Amdahl numeric example (fixed problem size) Given: serial fraction f_s = 0.10 (10%), total serial run time T1 = 100 s, use n = 8 processors. Compute T8, S(8), E(8). Step 1: serial time = f_s·T1 = 0.10·100 s = 10 s. Step 2: parallel portion on 1 proc = 90 s; on 8 procs parallel time = 90 / 8 = 11.25 s. Step 3: total T8 = 10 + 11.25 = 21.25 s. Step 4: speed-up S(8) = T1 / T8 = 100 / 21.25 ≈ 4.70588. Step 5: efficiency E(8) = S(8) / 8 ≈ 4.70588 / 8 ≈ 0.588235. Final answers: T8 = 21.25 s, S(8) ≈ 4.7059, E(8) ≈ 0.5882.

  2. Gustafson (scaled problem) example Given observed serial fraction on the parallel run s = 0.10 and n = 8. Compute scaled speed-up S(8). Use Gustafson: S(8) = n - (n - 1)·s = 8 - 7·0.10 = 8 - 0.7 = 7.3. Interpretation: for larger problem sizes the parallel portion grew and we get higher effective speed-up. S(8) = 7.3 (unitless).

  3. Iso-efficiency illustrative calculation Assume overhead T_o(n) = 0.01·n·log2(n) seconds (example model) and target efficiency E = 0.8. Find required useful work W in seconds to keep E=0.8 for n = 64. Step 1: compute T_o = 0.01·64·log2(64) = 0.01·64·6 = 3.84 s. Step 2: W = (E/(1 - E))·T_o = (0.8/0.2)·3.84 = 4·3.84 = 15.36 s. So you need at least W = 15.36 s of useful computation per run to maintain 80% efficiency at 64 processors under this overhead model.

Common mistakes

  • Ignoring communication and synchronization costs; using ideal formulas without stating assumptions.
  • Believing linear speed-up is typical; it is the upper bound under ideal conditions.
  • Confusing cost-optimality with efficiency: high efficiency does not guarantee cost-optimal total work.
  • Treating superlinear speed-up as a mathematical paradox rather than an effect of architecture (cache, I/O).

For your exam

Types of questions

  • Definitions: define speed-up, efficiency, iso-efficiency, cost-optimality.
  • Short notes: explain Amdahl's and Gustafson's laws and where each applies; explain communication model (α–β) and granularity.
  • Derivations: derive Amdahl's law and Gustafson's law step-by-step; derive W = (E/(1-E))·T_o for iso-efficiency.
  • Numericals: given T1 and f_s compute Tn, S(n), E(n); given α,β and message size compute comm. time; apply iso-efficiency to find required W.
  • Diagrams: timeline for Amdahl (serial then parallel blocks), processor grid showing parallel tasks, pie chart for fraction breakdown.

What a full-marks answer includes

  • Clear definitions with bolded terms (state units where applicable).
  • Explicit assumptions (fixed vs scaled problem; zero vs non-zero comm. cost).
  • Derivation steps (algebra) and a labelled diagram when requested.
  • A numeric example or conclusion interpreting results (e.g., saturation point, diminishing returns).
  • Mention of practical effects: skew, cache, I/O, network latency.

Quick check

  1. Define speed-up in one line.
  2. Using Amdahl's law, what is S(4) if f_s = 0.25?
  3. Give one reason why superlinear speed-up might be observed. Answers: S(n) = T1/Tn; S(4) = 1 / (0.25 + 0.75/4) = 1 / (0.25 + 0.1875) = 1 / 0.4375 ≈ 2.2857; superlinear speed-up can occur due to improved cache behaviour (each processor fits a partition in cache reducing total memory time).

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?