Master two-sided marketplace modeling (TICKIT, StubHub, Airbnb): separating Listing inventory supply from Sales settlements cleanly so you avoid Chasm Trap duplication.
Think about any two-sided marketplace—like StubHub, Airbnb, or the TICKIT live-events warehouse:
- Action 1 (Posting an Offer): A ticket seller posts 4 concert tickets (listing_id = 500, price = $100). Maybe 2 sell on Friday, 1 sells on Saturday, and 1 never sells!
- Action 2 (Completed Sale): Two different buyers each purchase tickets from that listing across separate checkout transactions (sale_id = 9001 for 2 tickets, sale_id = 9002 for 1 ticket).
Beginners try to cram Listings AND Sales into a single table—or join fact_listing straight to fact_sales! Look what happens:
listing_id = 500 listed 4 tickets (numtickets = 4). Joined directly to 2 sales rows (qtysold = 2 and qtysold = 1), `SUM(numtickets)` suddenly reads `4 + 4 = 8` tickets! Your marketplace thinks it has double the inventory it actually holds!
dim_event, dim_date, dim_user).| Term / Keyword | Plain-English Meaning | Marketplace Example |
|---|---|---|
| Two-Fact Architecture | Two independent Fact tables representing Supply (fact_listings) and Demand (fact_sales). | Tracks unsold seats *and* revenue cleanly without NULL-filled half-rows. |
| Chasm Trap | Joining two 1-to-Many Fact tables directly through a shared parent key (listing_id or event_id). | Silently multiplies metrics from whichever side repeats! |
| Drilling Across | Aggregating each Fact table separately to a shared Conformed Dimension (event_id), then joining those 1-row summaries! | Combines Total Listed Tickets + Total Sold Tickets accurately. |
| Conformed Dimension | Shared dimension (dim_event, dim_date, dim_venue) used identically across both Facts. | Guarantees "Rock Concerts" matches byte-for-byte across supply & demand teams. |
Consider `fact_listing` and `fact_sales` for Event E10:
| listing_id | event_id | seller_id | numtickets |
|---|---|---|---|
| L1 | E10 | U1 | 4 |
| L2 | E10 | U2 | 2 |
True Supply for E10 = `6` listed tickets.
| sale_id | listing_id | event_id | qty_sold | total_paid |
|---|---|---|---|---|
| S1 | L1 | E10 | 2 | 200.00 |
| S2 | L1 | E10 | 1 | 100.00 |
| S3 | L2 | E10 | 2 | 180.00 |
True Sales for E10 = `5` sold tickets, `$480.00` revenue.
-- WRONG: Joining listing -> sales clones L1 twice and L2 stays once (4 + 4 + 2 = 10!)
SELECT
l.event_id,
SUM(l.numtickets) AS inflated_listed,
SUM(s.qty_sold) AS sold
FROM fact_listing l
JOIN fact_sales s ON l.listing_id = s.listing_id
GROUP BY l.event_id;
-- Result: inflated_listed = 10 (67% WRONG!), sold = 5WITH event_supply AS (
SELECT
event_id,
COUNT(DISTINCT listing_id) AS listing_count,
SUM(numtickets) AS total_tickets_listed
FROM fact_listing
GROUP BY event_id
),
event_demand AS (
SELECT
event_id,
COUNT(DISTINCT sale_id) AS transaction_count,
SUM(qty_sold) AS total_tickets_sold,
SUM(total_paid) AS gross_merchandise_value
FROM fact_sales
GROUP BY event_id
)
SELECT
e.event_id,
e.event_name,
COALESCE(sup.total_tickets_listed, 0) AS listed_tickets,
COALESCE(dem.total_tickets_sold, 0) AS sold_tickets,
ROUND(
COALESCE(dem.total_tickets_sold, 0) * 100.0 / NULLIF(sup.total_tickets_listed, 0),
2
) AS sell_through_pct,
COALESCE(dem.gross_merchandise_value, 0) AS gmv_usd
FROM dim_event e
LEFT JOIN event_supply sup ON e.event_id = sup.event_id
LEFT JOIN event_demand dem ON e.event_id = dem.event_id;Output: listed_tickets = 6, sold_tickets = 5, sell_through_pct = 83.33%, gmv_usd = 480.00! Plus using LEFT JOIN from dim_event preserves events that received listings with 0 sales!
0 seats disappear from conversion funnels, artificially raising reported sell-through to ~100%!seller_id; Buyers belong strictly to fact_sales.sell_through_pct! Always sum total numerator / sum total denominator (SUM(sold) / NULLIF(SUM(listed), 0)).JOIN two Fact tables directly—avoid the Chasm Trap!0% cleanly.Test your understanding of the concepts covered in this lesson.
TICKIT Marketplace connects event ticket sellers with buyers. A single ticket listing (like 10 tickets for a concert) can be bought across several different transactions (4 tickets to one person, 6 tickets to another). If you join listings directly to sales without pre-aggregating, the rows multiply (Cartesian fan-out) and reported revenue gets inflated by 300%. We need a query that aggregates each table separately before joining.