HW 2 – Key-value data stores. Redis

(5 points)

  1. Design the data structures based on the analytical tasks (see HW 1) that are intended to be solved with Redis.
    • The structures must be designed so that the target queries are feasible.
    • Use native Redis data types (HASH/SET/ZSET/STREAM; BITMAP/HLL if needed). Avoid storing everything as plain strings/JSON.
    • Do not use Lua or Redis modules.
  2. Insert the data into Redis from the dataset produced in HW 0 (CSV/JSON).
    • Select and import only the subset/fields strictly required to execute your Redis tasks (do not import unnecessary data).
    • Document the selection/transformation rules (filters, projections, denormalization) so the same subset can be reproduced.
    • The import script must be idempotent: repeated runs must not create duplicates.
    • Do not pre-aggregate outside Redis: each raw event should map to one (or a small fixed bundle of) native Redis command(s).
  3. Implement and run the queries (see HW 1).
  4. Prepare a report and include:
    • the text from HW 0 and HW 1 (edited if necessary) related to Redis;
    • the structure-creation commands with explanations of why these structures were chosen;
    • the data import code;
    • the exact Redis commands used to load the minimal subset and the exact Redis commands used to answer the tasks;
    • the queries used to solve the analytical tasks. For each task, provide:
      • the task number (as in the HW 1);
      • the verbal description of the task;
      • the command(s) with a short explanation;
      • a screenshot of the query result.

Note. If some analytical tasks turn out to be infeasible under Redis’ data model or performance constraints, replace them with other meaningful tasks and propagate the corresponding changes to the earlier work (HW 0/HW 1).

Submit to the BRUTE system:

Submit hw2_insert.py, hw2_queries.py, base_small.txt, Q_small.txt, and the subset archive to the NoSQL server nosql.felk.cvut.cz.

Redis command dictionary tailored to HW2

Example of base_small.txt and Q_small.txt with explanation