page207
293
UNION ALL
SELECT *
FROM base_customer_order_delete;
note
UNION ALL
runs faster than
UNION
thus avoiding a
SORT
operation to
determine distinct rows.
Let’s confirm the raw or staging data has been created as expected:
SELECT count(1),
operation
FROM stg_customer_order
GROUP BY operation;
You should see 100,000 records each for
INSERT
,
UPDATE
, and
DELETE
.
With a low record sample size, you run the risk of generating a skewed data set. To
prevent this scenario, confirm you have records for all regions, and note the number of
regions for later use.
SELECT count(1),
region_name
FROM stg_customer_order
GROUP BY region_name;
Figure 8-16 shows sample expected results. Because of the way
LIMIT
works, your
results will vary.
Figure 8-16.
Regions and row counts
Chapter 8
parallelization