E-Commerce
Use streaming SQL to dynamically segment customers, deliver hyper-personalized experiences, and increase customer lifetime value.
Trusted by 1,000+ Data-Driven Organizations
for Real-time Analytics
The Problem
Batch-processed customer segments are stale the moment they are created. By the time your marketing platform acts on them, the customer has already moved on — and so has the revenue opportunity.
With RisingWave
RisingWave processes clickstream, cart, and purchase events as they happen. Create streaming SQL queries that continuously update customer segments, power personalization engines, and trigger real-time campaigns.
A fashion e-commerce site with 800K monthly active users wants to show 'Customers also viewed' recommendations that update with every click — not stale suggestions from last night's batch job. During flash sales, browsing patterns shift within minutes.
| event_id | session_id | user_id | product_id | product_name | category | action | ts |
|---|---|---|---|---|---|---|---|
| evt_8a3f21 | sess_a8f2k | usr_29481 | SKU-LB-1093 | Oversized Linen Blazer | outerwear | view | 2024-03-15T14:01:12.000Z |
| evt_8a3f22 | sess_a8f2k | usr_29481 | SKU-WL-2847 | Wide-Leg Linen Trousers | bottoms | view | 2024-03-15T14:01:48.000Z |
| evt_8a3f23 | sess_a8f2k | usr_29481 | SKU-CT-0412 | Canvas Mini Tote | bags | add_to_cart | 2024-03-15T14:02:05.000Z |
| evt_7b2e10 | sess_p3n7x | usr_10332 | SKU-WL-2847 | Wide-Leg Linen Trousers | bottoms | view | 2024-03-15T14:02:22.000Z |
| evt_7b2e11 | sess_p3n7x | usr_10332 | SKU-LB-1093 | Oversized Linen Blazer | outerwear | view | 2024-03-15T14:02:54.000Z |
| evt_7b2e12 | sess_p3n7x | usr_10332 | SKU-RT-5531 | Ribbed Tank Top | tops | purchase | 2024-03-15T14:03:17.000Z |
CREATE MATERIALIZED VIEW co_view_pairs AS
WITH session_views AS (
SELECT
session_id,
product_id,
product_name
FROM clickstream
WHERE action = 'view'
AND ts > NOW() - INTERVAL '30 MINUTES'
)
SELECT
a.product_id AS product_a,
a.product_name AS product_a_name,
b.product_id AS product_b,
b.product_name AS product_b_name,
COUNT(DISTINCT a.session_id) AS co_view_count
FROM session_views a
JOIN session_views b
ON a.session_id = b.session_id
AND a.product_id < b.product_id
GROUP BY a.product_id, a.product_name, b.product_id, b.product_name
HAVING COUNT(DISTINCT a.session_id) >= 3;| category | rank | product_name | engagement_score | view_count | cart_adds | window_start |
|---|---|---|---|---|---|---|
| bottoms | 1 | Wide-Leg Linen Trousers | 11 | 2 | 1 | 2024-03-15T14:00:00.000Z |
| outerwear | 1 | Oversized Linen Blazer | 2 | 2 | 0 | 2024-03-15T14:00:00.000Z |
| bags | 1 | Canvas Mini Tote | 3 | 0 | 1 | 2024-03-15T14:00:00.000Z |
| tops | 1 | Ribbed Tank Top | 5 | 0 | 0 | 2024-03-15T14:00:00.000Z |
| denim | 1 | High-Rise Straight Jeans | 2 | 0 | 0 | 2024-03-15T14:00:00.000Z |
Use the power of streaming SQL to transform your e-commerce operations and deliver experiences that convert.