99 weight : 70
1010---
1111
12+ {{< private-preview />}}
13+
1214When you create a [ MySQL source] ( /sql/create-source/mysql-v2/ ) , Materialize
1315performs an initial, snapshot-based sync of the selected tables before it
1416starts ingesting change events from the binlog. For large tables, this
1517snapshot dominates the time until the source becomes healthy.
1618
1719How snapshot work is spread across the workers of a cluster, and what that
1820means for the upstream database, is covered in
19- [ Snapshotting] ( /concepts/snapshotting/#parallelism ) . This page covers what is
20- specific to MySQL: Materialize can split the read of a ** single table**
21- across all the workers of the cluster, so that even a source dominated by one
22- very large table benefits from a larger cluster.
21+ [ Snapshotting] ( /concepts/snapshotting/#parallelism ) . Materialize can split
22+ the read of a ** single table** across all the workers of the cluster, so
23+ that even a source dominated by one very large table benefits from a larger
24+ cluster. This page covers what is specific to MySQL: which tables are
25+ eligible for splitting, and how their reads are partitioned.
2326
2427## Which tables are split
2528
26- The snapshot of an individual table is split across workers when all of the
27- following hold :
29+ Materialize splits the snapshot of an individual table across workers when
30+ all of the following conditions are met :
2831
2932- The table has a ** single-column primary key** . Composite primary keys are
3033 not supported.
@@ -39,19 +42,22 @@ following hold:
3942How evenly the split lands also depends on the distribution of the key
4043values. See [ How a table is partitioned] ( #how-a-table-is-partitioned ) .
4144
42- Tables that don't meet these requirements, or whose boundary sampling fails
43- for any reason, still snapshot correctly: each is read in full by a single
44- worker, and different tables are still read concurrently.
45+ If a table does not meet these requirements, or if the [ boundary
46+ sampling] ( #how-a-table-is-partitioned ) fails, its snapshot is not split: a
47+ single worker reads the table in full. Different tables are still read
48+ concurrently by different workers.
4549
4650## How a table is partitioned
4751
48- Materialize partitions a table by the unique leading characters of its
49- primary keys. Before reading the table, it probes the primary key index to
50- discover key prefixes and uses the MySQL optimizer's row estimates to gauge
51- how many rows fall under each one, extending prefixes until it finds
52- boundaries that divide the table into roughly even ranges. The probes are
53- inexpensive point lookups, capped in proportion to the table's estimated
54- size, so this sampling phase stays negligible next to the snapshot itself.
52+ Materialize partitions an [ eligible] ( #which-tables-are-split ) table using the
53+ leading characters of its primary key values. Before reading the table,
54+ Materialize probes the primary key index to discover key prefixes and uses
55+ the MySQL optimizer's row estimates to gauge how many rows fall under each
56+ prefix. It extends the prefixes as needed to find boundaries that divide the
57+ table into roughly even ranges. The probes are inexpensive point lookups,
58+ capped in proportion to the table's estimated size, so the sampling phase
59+ stays negligible next to the snapshot itself.
60+
5561Each worker then reads only its assigned range, within the same consistent
5662snapshot of the upstream database, so the result is identical to a
5763single-worker snapshot, only faster.
@@ -97,8 +103,6 @@ overloaded?](/ingest-data/troubleshooting/#is-the-upstream-database-overloaded)
97103
98104## Observability
99105
100- The progress of an ongoing snapshot is visible in the
101- [ ` mz_internal.mz_source_statistics ` ] ( /reference/system-catalog/mz_internal/#mz_source_statistics )
102- system catalog view: ` snapshot_records_known ` is the estimated total size of
103- the snapshot and ` snapshot_records_staged ` is how much of it has been read so
104- far.
106+ To observe the progress of an ongoing snapshot, see [ Monitoring the
107+ snapshotting
108+ progress] ( /ingest-data/monitoring-data-ingestion/#monitoring-the-snapshotting-progress ) .
0 commit comments