Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain raw tables and materialized views in Profiles Sync docs #7406

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions src/unify/profiles-sync/tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,38 @@ title: Profiles Sync Tables and Materialized Views
plan: unify
---

Through Profiles Sync, Segment provides data sets and models that can help you enrich customer profiles using any warehouse data available to you.
Through Profiles Sync, Segment provides data sets and models to help you enrich customer profiles using your warehouse data.

Using a practical example of how Segment connects and then merges anonymous profiles, this page explains the tables that Segment lands, as well as the tables you materialize as part of Profiles Sync.
This page compares raw tables and materialized views, explaining their roles and use cases. It also outlines the tables Segment lands and the tables you can materialize as part of Profiles Sync.

## Understanding raw tables and materialized views

Profiles Sync creates two types of tables in your data warehouse: raw tables and materialized views. These tables help you work with profile and event data at different levels of detail.

- Raw tables store unprocessed event-level data and capture all updates and changes as they occur.
- Materialized views take data from raw tables and organize it into a streamlined view of profile traits, identifiers, and merges.

The following table shows how raw tables map to their corresponding materialized views:

| Raw table | Materialized view | Description |
| ----------------------------- | ------------------ | ------------------------------------------------------------- |
| `id_graph_updates` | `profile_merges` | Tracks changes in profile merges across the identity graph. |
| `external_id_mapping_updates` | `user_identifiers` | Tracks external IDs associated with user profiles. |
| `profile_traits_updates` | `user_traits` | Tracks changes to user profile traits (like names or emails). |

Raw tables are best for detailed, event-level analysis or debugging specific updates in the identity graph. They show every single change and event in your Profiles Sync pipeline.

Materialized views are better for reporting, analytics, and when you need an up-to-date view of profile traits or identifiers. Materialized views reduce complexity by summarizing data from the raw tables.

For example, if you want to debug why a specific profile trait was updated, you'd look at the `profile_traits_updates` raw table. But if you want to see the current profile data for a marketing campaign, you'd probably opt for the `user_traits` materialized view.

## Case study: anonymous site visits lead to profile merge

This section uses a practical example of how Segment connects and merges anonymous profiles to illustrate how Profiles Sync populates and updates its tables.

To help illustrate the possible entries and values populated into Profiles Sync tables, view the event tabs below and consider the following scenario.
Explore the following event tabs to learn how these examples result in profile creation and merging.

Suppose the following four events lead to the creation of two separate profiles:
Suppose these four events lead to the creation of two separate profiles:

{% codeexample %}
{% codeexampletab Event 1 %}
Expand Down Expand Up @@ -75,6 +98,7 @@ Initially, Segment generates two profiles for the first three calls. In the fina
Profiles Sync tracks and provides information about these events through a set of tables, which you’ll learn about in the next section.



## Profile raw tables

Profile raw tables contain records of changes to your Segment profiles and Identity Graph over time.
Expand All @@ -83,7 +107,6 @@ With raw tables, you have full control over the materialization of Profiles in y

Raw tables contain complete historical data when using historical backfill.


### The id_graph_updates table

The `id_graph_updates` table maps between the following:
Expand Down