TapCub is live — analytics, insights and live chat, free on one platform
Analytics

Data modeling techniques for analytics: event stream vs star vs wide table

Entity-relationship, star schema, event stream and wide table compared on one 1,000-visitor sample: the same question gives the same answer in all four, but the cost lands in different places. Five rules for choosing.

Lin Zhou Published Nov 22, 2026 14 min read Analytics
Sample data: one question (893 pricing-page viewers, 277 signups within 7 days) on four builds of the same 1,000 visitors and 6,988 events. The wide table reads 1,000 rows against about 7,000 for the others, at the price of a rebuild when the definition changes.Sample data

The main data modeling techniques for analytics are entity-relationship, star schema, event stream and wide table, and they differ in where the cost lands: writes, queries or definition changes. On one 1,000-visitor sample all four answer the same question with the same number (277 of 893, 31.0%), so choose by how often your definitions change and who queries the data.

What you will learn

  • Same sample, same question, four builds, one answer: 277 of 893 pricing-page viewers signed up within 7 days (31.0%)
  • Land behavior as an event stream first; add a star schema or views for shared reports and a wide table only for hot dashboards
  • A wide table reads about one-seventh of the rows (1,000 vs 6,988) but must be rebuilt when a definition changes

The four models at a glance

Four data modeling techniques cover almost every product and web analytics setup. They differ in one thing above all: where the cost of a question is paid, at write time, at query time, or when the definition changes.

TechniqueShapeBuilt forWeak spot
Entity-relationship (normalized)Many small tables, one fact stored once, joined by keysOperational systems that write often and must stay consistentAnalytics questions need many joins
Star schema (dimensional)One fact table of events or measurements, surrounded by descriptive dimension tablesRepeated reporting by many people on shared definitionsNeeds design work up front; a new question may need a new dimension
Event streamOne append-only table, one row per thing that happened, with a name, a time, a subject and propertiesProduct and web analytics where new events appear every sprintEvery question re-derives sessions, funnels and first-times from raw rows
Wide tableOne row per user, session or user-day with dozens of precomputed columnsDashboards and models that ask the same few questions all dayThe columns are frozen answers; a new definition means a rebuild

Relational design goes back to Codd's 1970 paper on a relational model of data, and entity-relationship modeling to Chen's 1976 paper (both in Sources). Dimensional modeling is catalogued in Kimball Group's list of techniques, which names four kinds of fact table: transaction, periodic snapshot, accumulating snapshot and factless. The event stream is the shape Google Analytics 4 uses for its BigQuery export: a daily table named events_YYYYMMDD with one row per event and nested repeated fields for event_params, user_properties and items.

None of these is "the right one". The rest of the article builds the same small dataset four ways, asks one question of each, and then gives rules for choosing.

One sample dataset and one question

Sample data: 1,000 visitors and 6,988 events over the week of 2 November 2026. The events are 6,425 page views (/, /pricing, /docs) and 563 signups with a plan of free or pro. The dataset was generated with a fixed random seed, so every number below can be reproduced.

The question every model has to answer:

Of the visitors who viewed /pricing during the week, what share signed up within 7 days of their first pricing view?

It looks simple, but it needs three things analytics always needs: a filter on an event and a property (page), a "first time" per person, and a time window between two different events.

Answer, identical in all four models: 893 visitors viewed the pricing page, 277 of them signed up within 7 days, so the rate is 277 ÷ 893 = 31.0%. Getting the same number from four shapes is the check that each build is correct; the differences are in how much work each one made us do.

Entity-relationship model: one fact in one place

An entity-relationship (ER) model splits data so that each fact is stored once. Our sample becomes three tables: er_user (1,000 rows), er_pageview (6,425 rows) and er_signup (563 rows). A signup has a user_id, a time and a plan; a page view has a user_id, a path and a time. Nothing is repeated, so changing a plan name means updating one place.

WITH fp AS (
  SELECT user_id, MIN(viewed_at) AS t
  FROM er_pageview
  WHERE page = '/pricing' AND viewed_at >= '2026-11-02' AND viewed_at < '2026-11-09'
  GROUP BY user_id)
SELECT COUNT(*) AS viewers,
       SUM(EXISTS (SELECT 1 FROM er_signup s
                   WHERE s.user_id = fp.user_id
                     AND s.signed_at >= fp.t
                     AND s.signed_at < fp.t + INTERVAL '7 days')) AS signed_up
FROM fp;

Strengths: consistent, small, and easy to keep correct when applications write to it. Cost: every new kind of event is a new table, and every cross-event question joins them. With 25 event types you maintain 25 tables, and a funnel across five of them is a five-way join. That is why ER shapes are the right home for the application database and a poor home for the analytics copy.

Star schema: facts in the middle, context around them

A star schema keeps one fact table of measurable things and joins out to dimension tables that describe them. Ours is fact_event (6,988 rows: event id, user key, page key, event key, time) with dim_user (1,000 rows), dim_page (4 rows) and dim_event (2 rows).

The design discipline comes from Kimball's method: pick the business process, declare the grain (here: one row per event), then choose the dimensions and the facts. Declaring the grain is the step people skip, and the damage is silent: if some rows are per event and others per session, every count is wrong in a different direction.

WITH fp AS (
  SELECT f.user_key, MIN(f.ts) AS t
  FROM fact_event f
  JOIN dim_page  p ON p.page_key  = f.page_key
  JOIN dim_event e ON e.event_key = f.event_key
  WHERE e.name = 'page_view' AND p.path = '/pricing'
    AND f.ts >= '2026-11-02' AND f.ts < '2026-11-09'
  GROUP BY f.user_key)
SELECT COUNT(*) AS viewers,
       SUM(EXISTS (SELECT 1 FROM fact_event s
                   JOIN dim_event e ON e.event_key = s.event_key
                   WHERE s.user_key = fp.user_key AND e.name = 'signup'
                     AND s.ts >= fp.t AND s.ts < fp.t + INTERVAL '7 days')) AS signed_up
FROM fp;

Strengths: BI tools understand it, many people can slice by the same dimensions, and the dimension tables are tiny so the joins are cheap. Cost: someone has to decide the dimensions. A new property such as plan means altering a dimension or adding a column to the fact, and old rows need a backfill decision.

Event stream: one row per thing that happened

The event stream is the simplest shape and the one product analytics tools use. One table, events, with an id, a subject, an event name, a time and a few properties. In our sample it is 6,988 rows and the query needs no joins at all:

WITH fp AS (
  SELECT user_id, MIN(ts) AS t
  FROM events
  WHERE event_name = 'page_view' AND page = '/pricing'
    AND ts >= '2026-11-02' AND ts < '2026-11-09'
  GROUP BY user_id)
SELECT COUNT(*) AS viewers,
       SUM(EXISTS (SELECT 1 FROM events s
                   WHERE s.user_id = fp.user_id AND s.event_name = 'signup'
                     AND s.ts >= fp.t AND s.ts < fp.t + INTERVAL '7 days')) AS signed_up
FROM fp;

Strengths: a new event is just a new event_name value, with no migration; old data keeps its meaning; any question about order, timing or frequency can be asked later. Cost: sessions, funnels and "first time" are not stored anywhere, so each query rebuilds them from raw rows, and a typo in an event name creates a separate event for good. Properties that vary by event are usually stored as key-value pairs: GA4's export holds each parameter as a repeated record with key and typed values (string_value, int_value, double_value), which keeps the table narrow but makes every property access an unnest.

The two things that keep an event stream healthy are a naming convention (see data taxonomy) and a short list of properties per event that the team agreed to keep.

Wide table: precomputed answers, one row per subject

A wide table collapses events into one row per user (or session, or user-day) and adds a column for each thing you want to count or time. Our user_wide has 1,000 rows, one per visitor, with columns such as first_pricing_ts, first_signup_ts and events_total. The same question becomes a filter:

SELECT COUNT(first_pricing_ts) AS viewers,
       SUM(first_signup_ts >= first_pricing_ts
           AND first_signup_ts < first_pricing_ts + INTERVAL '7 days') AS signed_up
FROM user_wide
WHERE first_pricing_ts IS NOT NULL;

Strengths: fast, cheap, and trivial for analysts and machine-learning models, because the logic is already inside the column. Cost: the question is baked into the build. In our sample first_pricing_ts only looks at the week of 2 November. Ask the same thing for another week, or ask "signed up within 3 days", and the table has to be rebuilt from the event stream. A wide table is a cache of answers, so it needs the event stream (or a fact table) underneath it to rebuild from.

The same question across the four builds

Sample data, same 1,000 visitors, same result (893 viewers, 277 signups, 31.0%):

BuildTables the query touchesRows in those tablesJoinsRebuild if the definition changes
ERer_pageview, er_signup6,988 (6,425 + 563)0 in the query, many for other questionsNo, the query changes
Starfact_event plus two dimensions6,994 (6,988 + 4 + 2)2 per branchNo, the query changes
Event streamevents6,9880No, the query changes
Wideuser_wide1,0000Yes, the column is rebuilt

Two readings. First, the wide table reads about one-seventh of the rows (1,000 against 6,988), and that gap grows with traffic because events grow faster than users. Second, only the wide table pays for a changed definition with a rebuild; the other three just get a new query. This is the trade the opening table described: wide tables move cost from query time to change time.

app.tapcub.com

Rows the same question reads

sample data, rows in the tables touched
Wide table1,000
Event stream6,988
ER model6,988
Star schema6,994
Sample data
Sample data: one question (893 pricing-page viewers, 277 signups within 7 days) on four builds of the same 1,000 visitors and 6,988 events. The wide table reads 1,000 rows against about 7,000 for the others, at the price of a rebuild when the definition changes.

How to choose: five rules

  1. If the data is written by an application and must stay consistent, use ER there. Do not ask analysts to query it directly; copy it to the analytics side.
  2. If you track behavior and new events appear often, land the data as an event stream first. It is the only shape that never forces a decision you will regret.
  3. If many people report from the same definitions every week, add a star schema or views on top of the stream. Name the grain in one sentence and put it in the table description.
  4. If one dashboard or model asks the same question thousands of times a day, build a wide table from the stream. Keep the build script, so a changed definition is a rerun.
  5. If you are unsure, do not skip layers: stream first, then model above it. Going from a stream to a star or a wide table is a query; going from a wide table back to events is impossible.

A common stack is therefore all four at once: ER in the application, an event stream landing in the warehouse, a star or views for shared reporting, and a wide user-day table for the dashboards that need speed. For where the warehouse sits and how data gets there, see ETL vs ELT; for the definition of the term itself, see data model.

Your situationUseWhy
An application writes the data and must stay consistentEntity-relationshipEach fact is stored once
New events appear every sprintEvent streamA new event is a new name, not a migration
Many people report from shared definitionsStar schema or viewsShared grain and dimension names
One dashboard asks the same question all dayWide tableAnswers precomputed per user or day
You are not sure yetEvent stream firstStar and wide tables can be derived from it later

Going from an event stream to a star schema or wide table is a query; going back from a wide table to events is not possible.

Pitfalls that break any of the four

  • Mixed grain. One table where some rows are events and others are daily totals. Declare the grain in a sentence and test it: the row count must equal the number of things you said each row is.
  • Unstable event names. signup, sign_up and Signup are three events. Fix the naming rule before the second developer starts sending events.
  • No stable subject. The same person has an anonymous id before login and a user id after. If the model has no mapping, funnel counts are inflated; decide where identity is resolved and record it.
  • Properties without a type. A price that is sometimes "19.9" and sometimes 19.9 becomes two columns downstream. Keep one type per property.
  • Time zone drift. Store timestamps in UTC and convert at report time, or the "week" in this article's question moves by a day for some users.

How this looks in TapCub

TapCub stores behavior as an event stream: every pageview and custom event is a row with a name, a time, a visitor or person, and up to 20 properties. If you wanted to run the sample question on it, the steps are:

  1. Send the events with tapcub.track(name, props) and keep names in snake_case; the All-platform analytics › Data › Tracking plan page records the events you intend to collect, with property types and owners.
  2. Build the question as a funnel in All-platform analytics › Behavior › Behavior analysis: step 1 the pricing page view, step 2 the signup event, window 7 days. The funnel handles "first time per person" and the time window for you.
  3. For a cross-tab the built-in models do not give you, open the SQL tab in All-platform analytics › Behavior › Metrics & SQL. It exposes four views (v_events, v_sessions, v_persons, v_autocapture) scoped to your project; one SELECT or WITH, at most 50,000 rows, 30-second timeout.
  4. To keep your own warehouse, use All-platform analytics › Data › Data export, which makes an asynchronous raw export you can load as the stream layer.

TapCub does not build star schemas or wide tables for you; those are modeling choices on your side of the export. What it does is keep the event layer clean, which is the layer every other model depends on.

FAQ

What are the main data modeling techniques?

The common ones are entity-relationship (normalized) modeling, dimensional modeling with star and snowflake schemas, the event stream, and denormalized wide tables. Hierarchical, network and graph models also exist but are rarely used for analytics. Pick by where you want to pay the cost: writes, queries or changes.

Is a star schema still needed with a modern warehouse?

Often yes, for shared reporting. A warehouse can scan an event stream quickly, but a star schema gives everyone the same definitions and the same dimension names. It matters less for a team of two analysts and more for twenty report readers.

What is the difference between a wide table and an event stream?

An event stream has one row per thing that happened and keeps every detail. A wide table has one row per user, session or day and holds precomputed answers. The stream is flexible and slower to query; the wide table is fast and fixed.

Which model should a startup begin with?

Begin with the event stream. It needs no migration when you add an event, and you can derive a star schema or a wide table from it later with a query. Starting from a wide table loses the detail you will want for the next question.

Sources

Filed underAnalytics

Was this article helpful?

We use your answers to fix and expand this page.

Lin Zhou

Product Experience Specialist

Writes about product experience, practical workflows, and growth, turning complex processes into clear steps for everyday decisions.

Keep the event layer clean

One event model for web, app and mini program, a tracking plan, SQL views and raw export, in one project.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics