Data profiling: finding out how dirty your data really is, before you touch it

TL;DR

Difficulty: Intermediate

Profiling means reading your data systematically and writing down what is wrong, with counts, before you change anything.

  • Start with an inventory and the structure: types, keys and the constraints the database does not enforce.
  • Profile content: every form of empty, distinct counts raw and normalised, distributions per segment, frequency tables and pattern masks.
  • Check relationships with anti joins and match rates, dependencies with grouped counts, and cross field rules as questions, not verdicts.
  • Profile time: rows per day against a full calendar, lags, and the hourly fingerprint that reveals a column's clock.
  • Sample for rates, scan in full for rare problems and joins, keep personal data in place.
  • End with an issue list: every finding with its frequency and its impact.

Every report inherits whatever is wrong underneath it, so before you clean anything, you need to know what is actually there. This chapter profiles a whole online shop's data, from the Solidus database to the warehouse's CSV files and the GA4 export, one technique at a time. It ends with ten measured findings and the issue list that the cleaning decisions start from.

Look before you touch: what profiling is

Before you clean a single row, you need to know what is actually in your data. Not what the documentation says, not what the developer remembers, not what the dashboard implies. What is really there, row by row, column by column.

That is data profiling: reading a dataset systematically and producing facts about it. How many rows. Which columns are empty, and how often. Which values repeat. What the shortest and longest entries look like. Whether every order line points at an order that exists. Whether the numbers per day have gaps. The output is not clean data. The output is knowledge about dirty data, written down, with counts.

The research community has studied profiling for decades. The standard survey, by Abedjan, Golab and Naumann, sorts profiling tasks into three families1:

  • Single column profiling: counts of nulls and distinct values, data types, value patterns, distributions.
  • Multiple column profiling: correlations and other relationships between columns of one table.
  • Dependencies: unique column combinations (candidate keys), functional dependencies (one column determines another) and inclusion dependencies (every value in one column also appears in another, which is what a foreign key promises).

This article walks through all three, plus two families that matter enormously in practice and less in the papers: rules that cross fields ("delivered before it was ordered") and time ("why is Tuesday empty?").

Profiling sits between two other chapters of this series. The chapter on measuring whether data can be trusted defines the quality dimensions and turns each into a metric you track. Profiling comes first: it is how you discover which metrics you need and which thresholds are realistic. The next chapter, on deciding when to clean data and when to leave it alone, takes the issue list this article ends with and decides what to do about each item. Here, nothing gets fixed. Everything gets counted.

Example: a first week of profiling at Wrenfield Home

Wrenfield Home is an invented online homeware shop in Leeds (wrenfieldhome.example). It sells about 1,400 products, takes about 1,980 orders a month and has five years of order history. Priya owns it. Callum is her developer and data engineer.

Priya wants a customer dashboard: how many customers, what they are worth, where they come from. Callum could start building straight away. Instead he spends his first week profiling, because every number on that dashboard will inherit whatever is wrong underneath it.

His list of sources is the shop's full data landscape:

  • The shop itself: Ruby on Rails and Solidus on PostgreSQL, with tables such as spree_orders, spree_line_items, spree_users, spree_addresses and spree_variants.
  • Two tables kept from the migration off the old platform: legacy_order_lines and legacy_addresses.
  • Google Analytics 4 (GA4) with its daily export to BigQuery.
  • The third party logistics warehouse (the 3PL): a daily CSV of shipments and one of returns.
  • Three supplier product feeds.
  • Payment settlement files from Stripe and PayPal, the newsletter export, the customer service tickets and the hand kept marketing cost spreadsheet.

He works on a read replica of the shop database, so nothing he runs can slow down a customer's checkout. Every finding in this article comes from that week. All the numbers are invented for the example, and they stay the same across the whole series.

Start with an inventory: which tables, how big, how fresh

The first profile is not of any column. It is of the landscape: which tables exist, roughly how many rows each has, how much space they take, and what period they cover. This takes minutes and tells you where the effort will go.

In PostgreSQL the system catalogue already holds an estimate of each table's row count. The column reltuples in pg_class is that estimate. The documentation is clear that it is only an estimate used by the query planner, refreshed by VACUUM and ANALYZE, and that it holds the value minus one for a table that has never been analysed2. For an inventory, an estimate is exactly right: you want orders of magnitude, fast.

-- PostgreSQL: a quick inventory of the shop's tables
SELECT
  c.relname                                    AS table_name,
  c.reltuples::bigint                          AS estimated_rows,
  pg_size_pretty(pg_total_relation_size(c.oid)) AS total_size
FROM pg_class c
JOIN pg_namespace n ON n.oid = c.relnamespace
WHERE n.nspname = 'public'
  AND c.relkind = 'r'                -- ordinary tables only
  AND (c.relname LIKE 'spree\_%' OR c.relname LIKE 'legacy\_%')
ORDER BY pg_total_relation_size(c.oid) DESC;

The size tells you which tables you can scan freely and which need care. The next step is the time range: for every table with a timestamp, the earliest and latest value. A table that "has five years of history" but starts eight months ago is a finding before you have looked at a single value.

Example: the inventory of Wrenfield Home

Callum runs the inventory and then one min and max per time column. His summary:

SourceRowsPeriod coveredFirst observation
spree_orders412,300Nov 2021 to Nov 2026far more rows than orders
spree_line_items1,034,000Nov 2021 to Nov 2026
spree_users39,800Nov 2021 to Nov 2026accounts only, guests are elsewhere
spree_addresses171,500Nov 2021 to Nov 2026
legacy_order_lines64,500Mar 2020 to Oct 2021kept from the old platform
legacy_addresses21,300Mar 2020 to Oct 2021
3PL shipment filesone file a dayJan 2023 to today28 days checked in detail
GA4 events_ tablesone table a dayFeb 2023 to todayexport switched on later than GA4 itself

Five years of orders at about 23,760 a year is about 118,800 orders. Yet spree_orders has 412,300 rows. That gap is the first question of the week, and the next section answers it.

Structure: columns, types, keys and constraints

Structure profiling asks what the database promises about the data, before you check whether the data keeps those promises. Three things matter.

Declared types. A column declared numeric(10,2) cannot hold 71.9915. A column declared double precision can, and a column declared text can hold anything at all, including a date written three different ways. The query below lists every column with its type, nullability and default.

-- PostgreSQL: declared structure of the tables under study
SELECT table_name, column_name, data_type,
       numeric_precision, numeric_scale, is_nullable, column_default
FROM information_schema.columns
WHERE table_schema = 'public'
  AND table_name IN ('spree_orders', 'legacy_order_lines')
ORDER BY table_name, ordinal_position;

Declared keys and constraints. A primary key guarantees uniqueness. A foreign key guarantees that a reference points at something real. A NOT NULL or CHECK constraint guarantees a rule. What the database does not declare, it does not enforce, so every missing constraint is a place where dirt can live.

-- PostgreSQL: which constraints the database actually enforces
SELECT conrelid::regclass         AS table_name,
       conname                    AS constraint_name,
       contype                    AS kind,   -- p primary, f foreign, u unique, c check
       pg_get_constraintdef(oid)  AS definition
FROM pg_constraint
WHERE conrelid IN ('spree_orders'::regclass, 'spree_line_items'::regclass,
                   'spree_users'::regclass)
ORDER BY 1, 3;

This matters on Solidus in particular. Rails applications have long enforced relationships in application code rather than in the database, and Solidus has been adding database foreign keys only recently. The migration that added one between the address book and addresses in 2025 even ships with commented code to delete orphaned records first, in case the new constraint fails on existing data3. That is an honest admission that orphans exist in real shops, and a reason to check for them yourself.

Candidate keys. Some columns should be unique even if nothing enforces it: an order number, a SKU, an email address. Profiling tests each one, which is the uniqueness section further down.

The data types themselves, and why money must never be a floating point number, are the subject of the chapter on data types, schemas and formats. Here the job is only to find where the types are wrong.

Example: the structure of orders and legacy order lines

Callum's structure query returns, among others, these rows:

TableColumnDeclared typeNote
spree_orderstotalnumeric(10,2)money stored exactly, two decimals
spree_ordersnumbercharacter varying(32)no unique constraint found in this database
spree_ordersstatecharacter varyingfree text, no check constraint
spree_orderscompleted_attimestamp without time zoneRails stores UTC here
legacy_order_linesunit_pricedouble precisionmoney as a float
legacy_order_linesordered_ontexta date held as text

The Solidus core tables declare their money columns as decimal with precision 10 and scale 2 in the schema the project ships4. The legacy import did not. That is finding number 6 on the issue list, and the content profile later puts a number on it.

The constraint query shows primary keys on every table, a unique index on spree_users.email, and no foreign key from spree_line_items.order_id to spree_orders.id. So the database will happily store a line item for an order that does not exist. The relationship section checks whether it ever has.

Content: null rates, blanks and values that only pretend to exist

Now the values. The first content question for every column is how often it is empty, and "empty" has more forms than most people expect:

  • NULL, the database's marker for no value.
  • An empty string, which is a value of length zero and not NULL.
  • Whitespace only: a space, a tab, a line break someone pasted in.
  • A placeholder: "n/a", "none", "tbc", "0", "test", "-".

A form that requires a phone number will collect the placeholders. A system that converts empty strings to NULL on import will hide the difference. And tools can blur it too: by default, pandas reads an empty string, "NaN", "N/A", "NULL" and similar text as missing when it loads a CSV5. That is helpful for analysis and harmful for profiling, because you want to see exactly what the file contained, and a product SKU or a country code that happens to read "NA" would quietly become a missing value.

One query per column counts every form at once. FILTER lets each count have its own condition in a single pass over the table.

-- PostgreSQL: every form of "empty" for one column, on shipping addresses of completed orders
SELECT
  count(*)                                                    AS rows_total,
  count(*) FILTER (WHERE a.phone IS NULL)                     AS nulls,
  count(*) FILTER (WHERE btrim(a.phone) = '')                 AS blanks,
  count(*) FILTER (WHERE lower(btrim(a.phone))
                   IN ('n/a', 'na', 'none', 'tbc', '0', '-')) AS placeholders,
  count(DISTINCT a.phone)                                     AS distinct_values,
  min(length(a.phone))                                        AS min_length,
  max(length(a.phone))                                        AS max_length
FROM spree_orders o
JOIN spree_addresses a ON a.id = o.ship_address_id
WHERE o.completed_at IS NOT NULL;

Two habits make null rates useful rather than alarming.

First, profile the rows that matter, not the whole table. Addresses that belong to abandoned baskets are not your customers. Above, the join restricts the profile to completed orders.

Second, judge every null rate against what the column is for. A 60% null rate on the second address line is normal: most addresses do not need one. A 1% null rate on the postcode of a shipping address is a problem, because a parcel cannot be delivered without it.

Example: the null rate per column on shipping addresses

Callum runs the query for every column of the shipping addresses on the 118,800 completed orders and puts the results in one chart.

Invented example. Of 118,800 shipping addresses at Wrenfield Home, the share that is null or blank per column: company 93.8%, alternative phone 97.9%, second address line 61.4%, phone 1.2%, postcode 0.3%, and 0.0% for name, first address line and town. The high rates belong to optional fields. The low rates on phone and postcode are the real problems. Tap or click to open full screen and move around

The three tall bars look dramatic and are harmless: alternative phone, company and the second address line are optional fields. The two short bars are the findings. A 1.2% empty phone rate is 1,426 orders. A 0.3% empty postcode rate is 356 orders that someone must have fixed by hand before they could ship, which is worth a conversation with whoever does it.

The phone number has a second problem that the null rate cannot see. That comes in the pattern section.

Content: distinct counts and the keys that are not unique

The distinct count of a column tells you how many different values it holds. Divided by the number of rows, it gives the uniqueness ratio:

u=dnu = \frac{d}{n}

where uu is the uniqueness ratio, dd is the number of distinct non null values in the column, and nn is the number of non null rows. A ratio of 1 means every value is different, which is what a key needs. A ratio near 0 means a handful of values repeat, which is what a status or a country column looks like. See Foundations: ratios and rates if ratios are new.

The trap is that "distinct" depends on how strictly you compare. To a database, priya@example.com, Priya@example.com and priya@example.com with a trailing space are three different values. To the business, they are one person. So profile uniqueness twice: once on the raw value, once on a normalised value, and look at the difference.

-- PostgreSQL: raw versus normalised uniqueness of account emails
SELECT
  count(*)                              AS accounts,
  count(DISTINCT email)                 AS distinct_raw,
  count(DISTINCT lower(btrim(email)))   AS distinct_normalised
FROM spree_users
WHERE deleted_at IS NULL;

This is exactly where a database constraint can give false comfort. Solidus's authentication extension adds a unique index on spree_users.email6. In PostgreSQL a plain unique index compares text exactly, so it accepts two addresses that differ only in capital letters. Devise, the authentication library underneath, lowercases emails and strips whitespace by default before saving7, so accounts created through the shop are protected. Accounts inserted by a bulk import that bypassed the application are not.

Example: how many customers does Wrenfield Home really have?

Priya's customer report says 52,400 customers. Profiling shows where that number comes from: 39,800 accounts in spree_users plus 12,600 distinct email addresses that only ever checked out as guests.

Step 1, accounts. The query above returns 39,800 accounts, 39,800 distinct raw emails and 39,010 distinct normalised emails. So 790 accounts collide with another account once case and spaces are ignored. Callum checks their creation dates: all 790 arrived with the legacy import in October 2021.

Step 2, guests against accounts. He compares each guest email, normalised, with the normalised account emails:

-- PostgreSQL: guest checkout emails that belong to an existing account
WITH guest_emails AS (
  SELECT DISTINCT lower(btrim(email)) AS email_norm
  FROM spree_orders
  WHERE user_id IS NULL AND completed_at IS NOT NULL
),
account_emails AS (
  SELECT DISTINCT lower(btrim(email)) AS email_norm
  FROM spree_users
  WHERE deleted_at IS NULL
)
SELECT count(*) AS guests_with_account
FROM guest_emails g
JOIN account_emails a USING (email_norm);

Result: 834 guest identities belong to people who also have an account. They checked out as guests once or twice, usually on a phone, and the report counts them as separate customers.

Step 3, the total: 790+834=1,624790 + 834 = 1{,}624 duplicate customer records out of 52,400, which is

1,62452,400=0.031\frac{1{,}624}{52{,}400} = 0.031

or 3.1%. The true number of distinct customers is 52,400−1,624=50,77652{,}400 - 1{,}624 = 50{,}776.

Profiling stops here. It has measured the problem and found its two causes. How to merge the records properly, with matching rules and the edge cases they create, is the job of the later chapter on duplicates and entity resolution.

Content: minimum, maximum, distribution and percentiles

For numbers and dates, the next profile is the shape of the values: the smallest, the largest, the middle and the spread. The minimum and maximum catch impossible values fastest. An order total below zero, a quantity of 10,000, a birth date in 1900, a delivery date in 2099: each is one min or max away.

The middle and the spread need percentiles rather than the average. The average is pulled by extreme values, while the median (the 50th percentile) is the value in the middle when all values are sorted. The Foundations section on median and mode explains the difference, and the one on spread covers percentiles.

-- PostgreSQL: shape of the order total on completed orders
SELECT
  min(total)                                                AS min_total,
  percentile_cont(0.01) WITHIN GROUP (ORDER BY total)       AS p01,
  percentile_cont(0.25) WITHIN GROUP (ORDER BY total)       AS p25,
  percentile_cont(0.50) WITHIN GROUP (ORDER BY total)       AS median,
  round(avg(total), 2)                                      AS mean,
  percentile_cont(0.75) WITHIN GROUP (ORDER BY total)       AS p75,
  percentile_cont(0.99) WITHIN GROUP (ORDER BY total)       AS p99,
  max(total)                                                AS max_total,
  count(*) FILTER (WHERE total = 0)                         AS zero_totals
FROM spree_orders
WHERE completed_at IS NOT NULL;

One more habit separates a useful profile from a misleading one: profile per segment as well as overall. When a column mixes data from several sources, the overall distribution can look perfectly plausible while one source is completely wrong. Group the profile by source, supplier, country or channel, and compare the groups.

Example: order totals and supplier dimensions

The order total profile for the 118,800 completed orders:

MeasureValue
Minimum£0.00
1st percentile£9.50
25th percentile£38.00
Median£61.00
Mean£72.00
75th percentile£92.00
99th percentile£289.00
Maximum£4,860.00
Orders with a total of £0.0052

The mean of £72 sits above the median of £61, which is normal for order values: most orders are modest and a few large ones pull the average up. The maximum of £4,860 is one order worth 67 average orders. It might be an error or a trade customer furnishing a hotel. The later chapter on outliers deals with exactly that question. The 52 orders at £0.00 are the first trace of finding number 2, the test orders, which the top values section completes.

Then the segment profile. The product dimensions come from three supplier feeds, loaded into spree_variants.width, height and depth. Overall, the median width is 41.0, which looks like a believable number of centimetres. Grouped by supplier, it falls apart:

SupplierProductsMinimum widthMedian widthMaximum width
Supplier A6104.038.0180.0
Supplier B3802.542.5220.0
Supplier C41025.0410.02,000.0

Supplier C's cushions are not four metres wide. Its feed sends millimetres while the other two send centimetres. That is finding number 10: 410 of 1,400 products, 29.3%, with dimensions ten times too large, which matters the moment the shop calculates parcel sizes or shows a "fits through a standard door" note.

Content: top values and frequency tables

For a column with a limited set of values, the most revealing profile is a frequency table: every value, how often it occurs, and its share. Sorted by count, it shows the main values at the top and, more usefully, the strays at the bottom: typos, old codes, values from another system.

-- PostgreSQL: frequency table with shares, legacy addresses
SELECT
  country,
  count(*)                                              AS addresses,
  round(100.0 * count(*) / sum(count(*)) OVER (), 1)    AS share_pct
FROM legacy_addresses
GROUP BY country
ORDER BY addresses DESC;

sum(count(*)) OVER () is a window function: it adds up the counts of all groups, so each row can show its share of the total without a second query.

The same idea answers the riddle from the inventory. A frequency table of spree_orders.state explains why the table has 412,300 rows: most of them are baskets that never became orders.

Example: the order states and the country column

spree_orders.state on all 412,300 rows:

StateRowsShare
cart236,40057.3%
address31,9007.7%
delivery14,6003.5%
payment10,6002.6%
complete116,90028.4%
canceled1,1500.3%
returned7500.2%

The four checkout states add up to 293,500 baskets that stopped somewhere on the way. The three final states add up to 118,800, the real orders. Anyone who counts rows in this table instead of orders with a completed_at overstates orders by a factor of 3.5. That is not dirty data, it is how Solidus works, and the profile writes it down so nobody falls into it later. The chapter on SQL traps has more of these silent miscounts.

Now the country column of the 21,300 legacy addresses, which the old platform stored as free text:

ValueAddressesShare
United Kingdom12,99461.0%
UK4,68622.0%
GB1,9179.0%
England1,2786.0%
Great Britain2131.0%
Scotland1280.6%
Untied Kingdom430.2%
31 other values410.2%

Eight spellings of one country, one of them a typo, and a long tail of one off entries. That is finding number 8: 39% of legacy addresses do not use the main spelling, so any report that groups by country splits British customers into eight countries. The Solidus addresses do not have this problem, because they reference a country table by id. The later chapter on standardising values covers the cleaning, including the 41 strays.

Content: lengths and patterns

A value can be present, frequent and still wrong. Length and pattern profiling catches the wrong shape.

Length is the simple part: the shortest and longest value per column. A UK mobile number has 11 digits. A postcode has five to seven characters plus a space. An email address shorter than six characters is almost certainly not an email address.

Patterns go further. The technique is a mask: replace every digit with 9 and every letter with A, keep everything else, then count the masks. "07700 900123" becomes 99999 999999. "+44 7700 900123" becomes +99 9999 999999. Twenty thousand different phone numbers collapse into a dozen shapes, and the odd shapes stand out at once.

-- PostgreSQL: shape masks for phone numbers on completed orders
SELECT
  CASE WHEN a.phone IS NULL THEN '(null)'
       ELSE regexp_replace(regexp_replace(a.phone, '[0-9]', '9', 'g'),
                           '[A-Za-z]', 'A', 'g')
  END                                             AS pattern,
  count(*)                                        AS orders,
  round(100.0 * count(*) / sum(count(*)) OVER (), 1) AS share_pct
FROM spree_orders o
JOIN spree_addresses a ON a.id = o.ship_address_id
WHERE o.completed_at IS NOT NULL
GROUP BY 1
ORDER BY orders DESC;

The 'g' flag tells regexp_replace to replace every match rather than only the first8. Once the masks show the shapes, a regular expression can test the valid ones directly, but always look at the masks first. A validation rule written before you have seen the data encodes what you expect, and profiling exists to find out what you did not expect.

Example: phone numbers and two SKU formats

The phone masks on 118,800 completed orders:

PatternExample shapeShareVerdict
99999 999999mobile with a space41.2%valid
99999999999mobile, no space27.9%valid
+99 9999 999999international format14.6%valid
+999999999999international, no spaces9.3%valid
(99999) 999999landline with brackets3.0%valid
+99 (9) 9999 999999international with the old trunk zero2.0%valid but messy
(null) or blanknothing given1.2%missing
9999999 and shortertoo few digits0.5%invalid
AAA, A/A and similar"tbc", "n/a"0.2%invalid
all zeros or one digit repeatedplaceholder0.1%invalid

Six valid shapes make 98.0%. Missing adds 1.2%, invalid adds 0.8%. Together that is finding number 9: 1.2%+0.8%=2.0%1.2\% + 0.8\% = 2.0\% of orders, or 2,376 orders, without a usable phone number, which matters on the days the courier needs to call. The mask cannot tell "00000000000" from a real number, so Callum added a separate check for repeated digits. Patterns are a first pass, not the last word.

The same technique exposes finding number 3. Shop SKUs look like WH01023, mask AA99999. The SKUs in the 3PL's shipment file look like C0417WH01023, mask A9999AA99999. The 3PL prefixes every SKU with its own client code, C0417. No join between the two will ever match until someone maps one format to the other.

Relationships: orphans and match rates

A relationship profile asks whether references point at something real. In database terms this is an inclusion dependency: every value of the referencing column should appear in the referenced column1. When the database enforces a foreign key, the answer is guaranteed. When it does not, you test it with an anti join: rows on one side that find no partner on the other.

-- PostgreSQL: order lines whose order does not exist (orphans)
SELECT count(*) AS orphan_lines
FROM spree_line_items li
LEFT JOIN spree_orders o ON o.id = li.order_id
WHERE o.id IS NULL;

Between two systems that share no database, the same idea becomes a match rate: what share of the keys in file A can be found in system B.

m=kmatchedktotalm = \frac{k_{\text{matched}}}{k_{\text{total}}}

where mm is the match rate, kmatchedk_{\text{matched}} is the number of rows in the incoming file whose key is found in the target, and ktotalk_{\text{total}} is the number of rows in the file. A match rate is a ratio like any other (Foundations: ratios and rates). Measure it raw first, then after each transformation you think is needed, and watch which step closes the gap.

Example: matching the 3PL's shipments to the shop's products

Callum loads the 3PL shipment files into a profiling schema as text, exactly as delivered, and measures the match rate in three steps.

-- PostgreSQL: match rate of 3PL SKUs against shop SKUs, three attempts
WITH tpl AS (
  SELECT sku_3pl, substr(sku_3pl, 6) AS sku_stripped   -- drop the client code C0417
  FROM raw.tpl_shipments
  WHERE file_date BETWEEN DATE '2026-09-28' AND DATE '2026-10-25'
)
SELECT
  count(*)                                                        AS rows_total,
  count(*) FILTER (WHERE sku_3pl IN
        (SELECT sku FROM spree_variants WHERE deleted_at IS NULL))      AS match_raw,
  count(*) FILTER (WHERE sku_stripped IN
        (SELECT sku FROM spree_variants WHERE deleted_at IS NULL))      AS match_stripped,
  count(*) FILTER (WHERE sku_stripped IN
        (SELECT sku FROM spree_variants))                               AS match_incl_deleted
FROM tpl;
AttemptRows matchedMatch rate
Raw 3PL SKU against active shop SKUs0 of 1,7200.0%
Client code removed, against active SKUs1,713 of 1,72099.6%
Client code removed, against all SKUs including soft deleted ones1,720 of 1,720100.0%

The last step is the instructive one. Solidus does not delete a variant, it sets deleted_at and hides it. The seven unmatched rows were returns and late shipments of discontinued products. They were never dirty data. The filter deleted_at IS NULL, perfectly sensible for a product page, was wrong for a join with history. Profiling found a bug in the analyst's assumption, not in the file.

The orphan check on line items, by contrast, comes back with 0. No order line points at a missing order. That is also a finding: it is now a verified fact, written in the report, and a test can keep it true.

Relationships: functional dependencies

A functional dependency says that one column determines another: if you know XX, there is exactly one YY. Written X→YX \rightarrow Y. An order number should determine the order's email. A SKU should determine the product. A postcode determines a town only loosely, which is itself useful to know.

Testing one is a grouped count. If any value of XX has more than one distinct YY, the dependency is broken, and the rows tell you where.

-- PostgreSQL: does each SKU belong to exactly one product?
SELECT sku, count(DISTINCT product_id) AS products
FROM spree_variants
GROUP BY sku
HAVING count(DISTINCT product_id) > 1;

In real data, dependencies often hold almost but not completely. They are usually called approximate dependencies. In practice, measure the violation rate: the share of XX values that map to more than one YY. A rate of zero is a guarantee you can build on. A small rate is a list of exceptions to look at. A large rate means the dependency was never real, and any report that assumed it is wrong.

Example: three dependencies Callum relies on

DependencyViolationsWhat it means
spree_orders.number → email0 of 118,800 orderseach order has one customer email
spree_variants.sku → product_id0 of 1,400 active SKUs, 3 of 1,520 including deletedthree SKUs were reused for a new product after the old one was retired
3PL sku_3pl → stripped shop SKU0the client code mapping is one to one

The second line holds for active products and breaks for history: three SKUs were given to new products after the old ones were retired (invented for this example). A sales report over five years that groups by SKU merges two different products under one code for those three. Small, but now known and written down, which is the point.

Cross field rules: values that cannot both be true

Some errors only show when you look at two fields together. Each value is plausible on its own. The combination is impossible.

Typical rules for a shop:

  • An order cannot ship before it was completed.
  • A refund cannot exceed what was paid.
  • An order in a final state must have a completion time.
  • A discount cannot exceed the price of the line.
  • A return cannot be received before the shipment went out.

You write each rule as a condition and count the rows that break it. Nothing more is needed than a WHERE clause, but write every rule down with its count, including the rules that return zero.

-- PostgreSQL: cross field rules, one count per rule
SELECT 'shipped before completed' AS rule, count(*) AS violations
FROM spree_shipments s JOIN spree_orders o ON o.id = s.order_id
WHERE s.shipped_at < o.completed_at
UNION ALL
SELECT 'final state without completed_at', count(*)
FROM spree_orders
WHERE state IN ('complete', 'canceled', 'returned') AND completed_at IS NULL
UNION ALL
SELECT 'refunds above payment', count(*)
FROM (
  SELECT p.id
  FROM spree_payments p JOIN spree_refunds r ON r.payment_id = p.id
  GROUP BY p.id, p.amount
  HAVING sum(r.amount) > p.amount
) over_refunded;

Example: the rules at Wrenfield Home

RuleViolations
Shipped before completed37
Final state without a completion time0
Refunds above the payment0
Return received before shipment0

Thirty seven orders shipped before they were completed. Callum looks at them one by one. All 37 were created by staff in the admin, all on a weekday morning, all for customers who had phoned the day before. Priya confirms the practice (invented for this example): for a trade customer in a hurry, the parcel goes out first and the order is keyed in the next morning. So these rows are true. They are business as it happened, recorded late.

That is an important lesson about cross field rules. A violation is a question, not a verdict. The profile records these 37 as "explained, no action", and the rule gets a note so the next person does not investigate them again. The chapter on business rule cleaning later in the series deals with rows like these that are real but unusual.

Time: volume per day, gaps and time zones

Data arrives over time, and time profiling finds the problems that no single row can show. Three checks cover most of it.

Volume per day. Count rows per day and compare with what should be there. A gap is a day with no rows at all. A dip is a day with too few. A spike followed by a dip is a load that ran late. The trick for finding gaps is to generate the full calendar and join the data to it, because a day with no rows does not appear in a plain GROUP BY.

-- PostgreSQL: rows per file date, including days with no file at all
SELECT d::date                          AS file_date,
       count(t.file_date)               AS shipment_rows
FROM generate_series(DATE '2026-09-28', DATE '2026-10-25', INTERVAL '1 day') AS d
LEFT JOIN raw.tpl_shipments t ON t.file_date = d::date
GROUP BY d
ORDER BY d;

Lag. For every row, compare the time of the event with the time the row arrived. The distribution of that lag tells you how long you must wait before a day's numbers are complete.

Time zone fingerprints. The hours at which events happen are a fingerprint of the clock that recorded them. People shop by their local clock, and a warehouse works by its local clock. If a column is stored in Coordinated Universal Time (UTC), the daily peak moves by one hour when the clocks change in spring and autumn. If it is stored in local time, the peak stays put. That lets you prove which clock a column uses, even when nobody documented it. The chapter on data types and formats explains why timestamps without a zone are so dangerous.

Example: a missing day, late returns and a clock without a zone

The volume profile of the 3PL shipment files for four weeks, next to the shop's completed orders per day:

Invented example, 28 September to 25 October 2026. Wrenfield Home completes between 53 and 76 orders a day. The 3PL file of each day lists the shipments of the previous day's orders, so it follows the order line one day later, between 51 and 73 rows. On 13 October the 3PL line drops to 0: that day's file never arrived. On 14 October it returns to a normal 69 rows rather than a double day, so the 76 shipments of 12 October orders are missing, not late. Tap or click to open full screen and move around

The 3PL line follows the shop line one day later, because each file lists the previous day's dispatches. Then on Tuesday 13 October it drops to zero. The next day is normal, not double, so the file was not late: it was never sent. The 76 shipments of 12 October orders exist in the warehouse and nowhere in the data. Callum asks the 3PL to resend it.

The returns file has a different time problem. For every return row, he computes the lag between the date the 3PL received the parcel and the date of the file that reported it:

Lag in days012345
Share of return rows61%18%9%6%4%2%

Only 61% of returns are reported on the day they arrive, and the last arrive five days late. Together with the missing file, that is finding number 4: the 3PL feed is not complete for any day until five days have passed, so a return rate computed this morning for yesterday is too low.

Finally the clock. Callum compares the hours of the 3PL's dispatch timestamps in January and July:

Invented example. Share of the 3PL's dispatch timestamps per hour of the day, from 8 to 16. January and July are almost identical: 4% and 5% at 8, 13% and 12% at 10, 14% and 14% at 11, 8% and 8% at 16. The working day does not move when British Summer Time starts, so the timestamps are in local time, not UTC. Tap or click to open full screen and move around

The warehouse works from 8am to 4pm, and its timestamps show 8 to 16 in winter and in summer. If they were stored in UTC, the summer working day would appear as 7 to 15. So the 3PL records local time without saying so. The shop's own completed_at, by contrast, has its evening peak at 20:00 in January and at 19:00 in July: the customers still shop at 8pm on their own clocks, and the column records UTC. That is finding number 7: every 3PL timestamp is in UK local time with no zone, and in summer every comparison with the shop's times is off by one hour.

One more time check belongs here, because it is the gap everyone notices first. Comparing purchases per day in the GA4 export with completed orders in the shop shows GA4 at 85% of the shop's count, steadily, every day: 1,683 purchases against 1,980 orders in October. The daily table and its fields are documented by Google: each events_YYYYMMDD table holds one day, event_timestamp is in microseconds and UTC, while event_date follows the property's own time zone9. So a comparison by event_date and by the shop's UTC date will not line up exactly around midnight, which is worth knowing before you blame the gap on anything else.

-- BigQuery (GoogleSQL): GA4 purchases per day for October 2026
SELECT
  PARSE_DATE('%Y%m%d', event_date)                     AS day,
  COUNT(DISTINCT ecommerce.transaction_id)             AS purchases
FROM `wrenfield-analytics.analytics_123456789.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20261001' AND '20261031'
  AND event_name = 'purchase'
GROUP BY day
ORDER BY day;

That is finding number 5: GA4 sees 15% fewer purchases than the shop, consistently, which points at consent choices and blockers rather than a broken tag. The article on when analytics, ads and orders disagree explains how to reconcile the two in full.

Sampling: profiling big tables without reading everything

Wrenfield Home's tables are small enough to scan in seconds. Many are not. When a table has hundreds of millions of rows, or a warehouse charges per byte read, you profile a sample first. Done well, it gives reliable rates for a fraction of the cost. Done badly, it hides exactly the problems you are looking for.

Free statistics first. PostgreSQL already profiles every analysed table for its query planner. The view pg_stats shows, per column, the fraction of nulls (null_frac), an estimate of distinct values (n_distinct, negative when expressed as a fraction of the row count), the most common values with their frequencies, and histogram bounds10. ANALYZE builds these from a random sample, so they are approximate11. For a first look at a large table, nothing is faster.

-- PostgreSQL: the planner's own profile of a table, at no cost
SELECT attname AS column_name, null_frac, n_distinct,
       most_common_vals, most_common_freqs
FROM pg_stats
WHERE schemaname = 'public' AND tablename = 'spree_addresses';

Then a seeded sample. PostgreSQL's TABLESAMPLE takes a percentage of a table. BERNOULLI decides row by row, so it is properly random but still reads the whole table. SYSTEM picks whole storage pages, which is much faster but can return a less random sample when similar rows are stored together12. REPEATABLE with a seed returns the same sample every time, which makes a profile reproducible.

-- PostgreSQL: a reproducible 1% sample of completed orders
SELECT *
FROM spree_orders TABLESAMPLE BERNOULLI (1) REPEATABLE (42)
WHERE completed_at IS NOT NULL;

BigQuery works differently. Its TABLESAMPLE SYSTEM picks whole storage blocks, so the share of rows you get can vary, and BigQuery does not cache the results. Google's documentation also warns that joining two sampled tables can return no matches at all when the sampled rows do not overlap13. For distinct counts on huge tables, BigQuery offers APPROX_COUNT_DISTINCT, which returns a statistical estimate and costs far less than an exact COUNT(DISTINCT ...)14. When you need to choose the precision yourself, the same page points to the HyperLogLog++ functions (HLL_COUNT) instead14.

How big a sample. To estimate a rate, such as the share of invalid phone numbers, the sample size you need depends on how precise you want to be:

n=z2 p (1−p)E2n = \frac{z^2 \, p \, (1 - p)}{E^2}

where nn is the number of rows to sample, zz is the number of standard errors for your chosen confidence (1.96 for 95%), pp is your best guess of the rate, and EE is the margin of error you accept, as a share. Foundations: sample size and Foundations: confidence intervals explain where this comes from.

Rare problems need full scans. The catch is rare problems. If a problem affects a share pp of rows, the chance that a random sample of nn rows contains not a single example is

P(none)=(1−p)nP(\text{none}) = (1 - p)^n

where P(none)P(\text{none}) is the probability that the sample shows no affected row at all, pp is the true share of affected rows, and nn is the sample size. See Foundations: probability.

And one rule without exceptions: never sample both sides of a join when you check relationships. Two independent 1% samples share almost no keys, so every row would look like an orphan. Sample one side if you must, and check it against the full other side.

Example: sizing Callum's sample, and what it would miss

Suppose the order tables were a hundred times larger and Callum had to sample. He wants the phone problem rate to within half a percentage point, with 95% confidence, and expects about 2%. So z=1.96z = 1.96, p=0.02p = 0.02 and E=0.005E = 0.005:

n=1.962×0.02×0.980.0052=3.8416×0.01960.000025=0.075295360.000025=3,011.8n = \frac{1.96^2 \times 0.02 \times 0.98}{0.005^2} = \frac{3.8416 \times 0.0196}{0.000025} = \frac{0.07529536}{0.000025} = 3{,}011.8

Rounded up, n=3,012n = 3{,}012 rows are enough to measure the phone rate, whatever the size of the table.

Now the test orders. Over five years there are 200 among 118,800 completed orders:

p=200118,800=0.00168p = \frac{200}{118{,}800} = 0.00168

A 1% sample has n=1,188n = 1{,}188 rows. The chance that it contains no test order at all:

P(none)=(1−0.00168)1,188=0.135P(\text{none}) = (1 - 0.00168)^{1{,}188} = 0.135

So P(none)=0.135P(\text{none}) = 0.135: a 13.5% chance that the sample shows no sign of the problem, and even when it does, it shows about two rows. Two rows prove the problem exists. They cannot tell you how many there are or which ones. That is why Callum samples for rates and scans in full for rare problems, keys and relationships.

Tools: plain SQL, Python, dbt and the warehouse's own profiler

Everything in this article so far runs on plain SQL, and plain SQL is the tool I would start with: it runs where the data lives, it needs no installation, and it goes into version control next to the pipeline. Four other tools are worth knowing.

ToolWhat it doesWhere it fits
Plain SQLany profile you can writealways, and the only option for cross field rules and joins
pg_statsthe planner's sampled statistics per columna free first look at large PostgreSQL tables
ydata profiling (Python)an HTML report per dataframe: types, missing values, distributions, correlationsfiles and extracts before they reach the warehouse
dbt profiler packagea profile per model or source as a dbt model or a printed tablewarehouse tables in a dbt project
BigQuery data profile scansmanaged profiles of BigQuery tables, with samplinglarge BigQuery tables without writing SQL

ydata profiling. The open source Python library formerly known as pandas profiling builds an HTML report from a pandas dataframe. For larger datasets its documentation recommends minimal=True, which switches off the most expensive calculations15. For personal data, sensitive=True keeps individual records out of the report so that only aggregates are shown16. The report is a file on someone's laptop, so the second setting matters more than it looks.

# Profile an extract with ydata profiling, without exposing single records
import pandas as pd
from ydata_profiling import ProfileReport

orders = pd.read_parquet("orders_extract_2026_10.parquet")
report = ProfileReport(
    orders,
    title="Completed orders, October 2026",
    minimal=True,     # skip the most expensive calculations
    sensitive=True,   # aggregates only, no sample rows in the report
)
report.to_file("orders_profile_2026_10.html")

dbt profiler. The dbt_profiler package by data mie computes, per column, the share of non null values, the distinct count and share, whether the column is unique, minimum, maximum, mean, median and standard deviations. It supports BigQuery, PostgreSQL, Snowflake and Redshift among others, and its current release requires dbt 1.10 or later17.

# packages.yml
packages:
  - package: data-mie/dbt_profiler
    version: [">=1.0.0", "<2.0.0"]
-- models/profiles/profile_stg_orders.sql
{{ dbt_profiler.get_profile(relation=ref("stg_orders")) }}

Run as a model, the profile becomes a table in the warehouse, so you can keep one per month and compare them. From the command line, dbt run-operation print_profile --args '{"relation_name": "stg_orders"}' prints it as a Markdown table.

BigQuery data profile scans. Google describes them as scans that analyse the statistical characteristics of a table, such as average, unique and maximum values, with an optional sampling percentage for large tables18. Useful when the warehouse is big and the team is small. They run through Google's data governance service and need its permissions set up, so they are a step for later, not for week one.

What no tool does for you is the thinking: which segments to compare, which rules cross fields, which joins must hold. Tools produce numbers per column. Findings come from a person asking why.

Example: profiling the 3PL file before it reaches the warehouse

The 3PL's daily file is semicolon delimited and encoded in Windows 1252, the old Windows character set, as the chapter on where raw data comes from describes. Callum profiles each file as it arrives, reading every value as text so that nothing is converted or lost on the way in:

# profile_3pl.py: profile one 3PL file exactly as delivered
import sys
import pandas as pd

def mask(value: str) -> str:
    """Replace digits with 9 and letters with A, keep everything else."""
    if value == "":
        return "(blank)"
    return "".join("9" if c.isdigit() else "A" if c.isalpha() else c for c in value)

path = sys.argv[1]
df = pd.read_csv(
    path,
    sep=";",
    encoding="cp1252",       # Windows 1252, as the 3PL sends it
    dtype=str,               # every value as text, nothing converted
    keep_default_na=False,   # an empty field stays "", the text "NA" stays "NA"
)

print(f"{path}: {len(df)} rows, {len(df.columns)} columns")
for col in df.columns:
    s = df[col]
    blank_share = (s.str.strip() == "").mean()
    top = s.map(mask).value_counts().head(3)
    patterns = ", ".join(f"{p} ({n})" for p, n in top.items())
    print(f"{col:<14} blank {blank_share:6.1%}  distinct {s.nunique():>4}  "
          f"length {s.str.len().min()} to {s.str.len().max()}  patterns: {patterns}")

Its output for the file of 14 October:

shipments_20261014.csv: 69 rows, 5 columns
order_ref      blank   0.0%  distinct   69  length 10 to 10  patterns: A999999999 (69)
sku_3pl        blank   0.0%  distinct   61  length 12 to 12  patterns: A9999AA99999 (69)
qty            blank   0.0%  distinct    3  length 1 to 1  patterns: 9 (69)
dispatched_at  blank   0.0%  distinct   69  length 16 to 16  patterns: 99/99/9999 99:99 (69)
carrier        blank   1.4%  distinct    3  length 0 to 4  patterns: AAAA (41), AAA (27), (blank) (1)

Five lines say a great deal. Order references have the shape of Solidus order numbers, an R and nine digits. The SKU has the 3PL's prefixed shape. The dispatch time is a day, month and year with slashes and a time, but no zone. And one row in 69 has no carrier. Run every morning, the same script would have flagged the missing file of 13 October within hours, because there would have been no file to profile.

Profiling personal data without creating a new risk

Profiling customer tables means reading personal data: names, emails, phone numbers, addresses. A few rules keep the profile from becoming a privacy problem of its own. This is general information, not legal advice.

First, the word. In data protection law, "profiling" means something else entirely. The UK GDPR defines it as automated processing of personal data to evaluate personal aspects of a person, such as their economic situation, preferences, behaviour or movements19. Data profiling in the sense of this article evaluates columns, not people. Keep the two apart in documents, because a policy that says "customer data is profiled" will be read the legal way.

Second, data minimisation still applies. Personal data must be adequate, relevant and limited to what is necessary for the purpose20. The Information Commission's (formerly the ICO's) guidance spells that out as holding no more than you need for the stated purpose21. For profiling, that translates into habits:

  • Profile in place, on the replica or in the warehouse, rather than exporting customer tables to a laptop.
  • Keep aggregates, not rows. A profile needs "1.2% of phone numbers are empty", not the list of customers without one.
  • When a finding needs examples, look at them where they live and do not paste them into the report.
  • Switch off sample rows in tools that show them, such as sensitive=True in ydata profiling.
  • Store the report where access is controlled, and delete working extracts when the profile is done.

Example: what Callum's report contains and what it leaves out

Callum's profiling report on customers says that 1,624 of 52,400 customer records are duplicates and explains the two causes. It shows the query that found them. It does not list a single email address. The pattern table for phone numbers shows shapes and counts, never numbers. The 37 phone orders are described by their creation pattern, not by customer. The ydata report on the October extract runs with sensitive=True and lives in the project folder that only Priya and Callum can open. The extract itself is deleted the same day. Nothing in the report would need protecting if it were emailed by mistake, which is the simplest test of whether a profiling report is minimised.

Writing up the profiling report

A profile that lives only in a query history is lost the day it is run. Write it up, briefly, in a fixed shape, so that the next profile of the same data can be compared with this one.

A good profiling report has six parts:

  1. Scope: which sources and tables, which period, on which date, from which copy of the data.
  2. Method: the queries and scripts, kept in the repository next to the pipeline, so anyone can rerun them.
  3. Structure: types, keys, constraints, and where they differ from what the data needs.
  4. Findings per table: each one with the rule or measure, the count, the share and the denominator. "2.0% of 118,800 completed orders" is a finding. "Some phone numbers are bad" is not.
  5. Verified facts: the checks that came back clean, such as zero orphan order lines. They become tests later.
  6. The issue list: every finding in one table, with frequency and impact.

Example: the outline of Callum's report

Callum's report is four pages in the project's repository, named profiling/2026-10-shop-baseline.md. Scope: the shop replica as of 26 October 2026, the legacy tables, 28 days of 3PL files, October's GA4 export and the three supplier feeds. Method: twelve SQL files and the Python script, all in profiling/queries/. Structure: the float column, the text date, the missing foreign key. Findings per table, each with its count and denominator. Verified facts: no orphan lines, no over refunded payments, no final orders without a completion time, order number determines email. Then the issue list, which is the next section.

From findings to an issue list: frequency and impact

The issue list turns a profile into something a business can act on. Each line has two measures.

Frequency is how much of the data is affected, as a share of the right denominator: affected rows divided by all the rows where the problem could occur. The denominator matters as much as the numerator, so state it every time.

Impact is what the problem distorts: which number, which decision, which customer. Where it can be measured in money or in a key figure, measure it. For a count that is inflated by duplicates, the distortion is easy to compute:

b=Nreported−NtrueNtrueb = \frac{N_{\text{reported}} - N_{\text{true}}}{N_{\text{true}}}

where bb is the relative overstatement, NreportedN_{\text{reported}} is the count the report shows, and NtrueN_{\text{true}} is the count after removing duplicates. Foundations: percentages covers the arithmetic.

Example: the ten findings at Wrenfield Home

First the duplicate customers. The report shows 52,400 customers, the truth is 50,776:

b=52,400−50,77650,776=1,62450,776=0.032b = \frac{52{,}400 - 50{,}776}{50{,}776} = \frac{1{,}624}{50{,}776} = 0.032

So the customer count is overstated by 3.2%, and anything divided by it, such as revenue per customer, is understated by 1−50,77652,400=3.1%1 - \frac{50{,}776}{52{,}400} = 3.1\%. A lifetime value figure that is 3.1% low is a small error with a long reach, because it feeds the acquisition budget.

The test orders: 200 orders over five years, worth £8,640 in total. Against about £8.55 million of revenue over the same period (118,800 orders at £72), that is 0.1%, small in revenue. But they are concentrated: 162 of them carry the shop's own email domain and sit in the weeks before each release, so a weekly sales chart shows bumps that never happened.

Here is the complete list Callum hands to Priya:

No.FindingWhereAffectedShareWhat it distorts
1Duplicate customers (case and spaces, guest plus account)spree_users, guest orders1,624 of 52,400 records3.1%customer count up 3.2%, value per customer down 3.1%
2Test and staff ordersspree_orders200 of 118,800 orders0.17%revenue £8,640 too high, release weeks inflated
33PL SKUs carry a client code prefix3PL files1,720 of 1,720 rows100%no join to products without mapping
43PL feed incomplete: a missing day, returns up to 5 days late3PL files1 of 28 files, 39% of returns latesee textrecent return rates too low, one day of shipments lost
5GA4 records fewer purchases than the shopGA4 export297 of 1,980 October orders15%conversion rate and channel reports too low
6Legacy prices stored as floating pointlegacy_order_lines3,870 of 64,500 lines with more than two decimals6.0%pre 2021 revenue off by pennies per line
73PL timestamps in local time without a zone3PL filesevery timestamp100%summer lead times off by one hour
8Country as free text in eight spellingslegacy_addresses8,306 of 21,300 not in the main spelling39.0%country reports split one country into eight
9Phone missing or invalidshipping addresses2,376 of 118,800 orders2.0%couriers cannot call, SMS updates fail
10One supplier sends millimetresspree_variants410 of 1,400 products29.3%parcel sizes and product pages wrong

The share column alone would rank them badly. The 3PL prefix affects 100% of rows and is trivial to handle once known. The test orders affect 0.17% and distort every release week. That is why the list carries impact next to frequency, and why it stops here. Deciding which of the ten to fix at the source, which to clean in the pipeline and which to leave and flag is a different question, with its own framework, and the next chapter in this series works through these ten findings one by one.

Profiling is not a one off

The first profile is a baseline. Its value grows every time you repeat it, because a profile compared with the previous one shows what changed, and change is where new problems come from.

Repeat it at four moments:

  • When a new source arrives: a new supplier, a new payment provider, a new export. Profile before the first load, not after the first wrong report.
  • Before and after a migration: the same profile on old and new systems, compared line by line. The migration articles on customer accounts and addresses and order history show why the legacy tables in this example exist at all.
  • When a vendor changes something: a new file version, a changed API, a new consent banner.
  • On a schedule: monthly is plenty for a shop of this size.

Then promote the stable findings. A verified fact like "no orphan order lines" becomes a test that runs on every load. A measured rate like "2.0% invalid phones" becomes a monitored metric with a threshold, using the quality dimensions from the data quality chapter. Later chapters in this series cover testing pipelines and data observability in depth. Profiling is how you find out what is worth testing and monitoring in the first place.

Example: the monthly rerun

Callum schedules the twelve queries and the 3PL script to run on the first Monday of every month, writing their results to a profiling schema with the run date. In November a new supplier, Supplier D, sends its first feed. The segment profile of widths shows a median of 3.9 for its 120 products: metres. Without the monthly profile, that would have reached the product pages. With it, it is one line in the November report and one email to the supplier, sent before the first product went live.

Conclusion

Profiling is reading your data before you change it, and writing down what you find with counts and denominators. Start with an inventory of tables, sizes and periods. Check the structure: types, keys and the constraints the database does and does not enforce. Then profile content: every form of empty, distinct counts raw and normalised, distributions per segment, frequency tables, lengths and pattern masks. Test relationships with anti joins and match rates, and dependencies with grouped counts. Write cross field rules and treat each violation as a question. Profile time: volume per day against a full calendar, lags, and the hour fingerprint that reveals a column's clock. Sample for rates, scan in full for rare problems and joins, and keep personal data in place with only aggregates in the report. End with an issue list that gives every finding its frequency and its impact, then decide what to do about each one. At Wrenfield Home, one week of profiling turned "the data is a bit messy" into ten measured findings, and every number on Priya's dashboard will be better for it.

If you want to know how dirty your own shop's data really is before you build the next dashboard on it, book the free workshop: we profile your key tables together, and the first two weeks of work are on me.

Sources

  1. 1.

    Ziawasch Abedjan, Lukasz Golab and Felix Naumann, Profiling relational data: a survey, The VLDB Journal, volume 24, issue 4, pages 557 to 581, 2015, https://doi.org/10.1007/s00778-015-0389-y

  2. 2.

    PostgreSQL Global Development Group, pg_class, PostgreSQL documentation (current), https://www.postgresql.org/docs/current/catalog-pg-class.html

  3. 3.

    Solidus, migration AddAddressbookForeignKey (core/db/migrate/20250530102541_add_addressbook_foreign_key.rb), GitHub, 2025, https://github.com/solidusio/solidus/blob/main/core/db/migrate/20250530102541_add_addressbook_foreign_key.rb

  4. 4.

    Solidus, migration SolidusOneFour, the base schema of the Solidus core tables (core/db/migrate/20160101010000_solidus_one_four.rb), GitHub, https://github.com/solidusio/solidus/blob/main/core/db/migrate/20160101010000_solidus_one_four.rb

  5. 5.

    pandas development team, pandas.read_csv, pandas API reference, https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html

  6. 6.
  7. 7.

    Devise, lib/devise.rb, default settings case_insensitive_keys and strip_whitespace_keys, GitHub, https://github.com/heartcombo/devise/blob/main/lib/devise.rb

  8. 8.

    PostgreSQL Global Development Group, Pattern matching, PostgreSQL documentation (current), https://www.postgresql.org/docs/current/functions-matching.html

  9. 9.

    Google, [GA4] BigQuery Export schema, Analytics Help, https://support.google.com/analytics/answer/7029846

  10. 10.

    PostgreSQL Global Development Group, pg_stats, PostgreSQL documentation (current), https://www.postgresql.org/docs/current/view-pg-stats.html

  11. 11.

    PostgreSQL Global Development Group, ANALYZE, PostgreSQL documentation (current), https://www.postgresql.org/docs/current/sql-analyze.html

  12. 12.

    PostgreSQL Global Development Group, SELECT, the TABLESAMPLE clause, PostgreSQL documentation (current), https://www.postgresql.org/docs/current/sql-select.html

  13. 13.

    Google Cloud, Table sampling, BigQuery documentation, https://cloud.google.com/bigquery/docs/table-sampling

  14. 14.

    Google Cloud, Approximate aggregate functions, BigQuery GoogleSQL reference, https://cloud.google.com/bigquery/docs/reference/standard-sql/approximate_aggregate_functions

  15. 15.

    YData, Profiling large datasets, YData Profiling documentation, https://docs.profiling.ydata.ai/latest/features/big_data/

  16. 16.

    YData, Handling sensitive data, YData Profiling documentation, https://docs.profiling.ydata.ai/latest/features/sensitive_data/

  17. 17.

    data mie, dbt profiler, README and release 1.0.0 (February 2026), GitHub, https://github.com/data-mie/dbt-profiler

  18. 18.

    Google Cloud, Profile your data, BigQuery documentation, https://cloud.google.com/bigquery/docs/data-profile-scan

  19. 19.

    UK GDPR, Article 4 (definitions), point 4, legislation.gov.uk, https://www.legislation.gov.uk/eur/2016/679/article/4

  20. 20.

    UK GDPR, Article 5 (principles relating to processing of personal data), paragraph 1(c), legislation.gov.uk, https://www.legislation.gov.uk/eur/2016/679/article/5

  21. 21.
Shelter

I’m running the London Marathon for Shelter. Sunday 25 April 2027

My personal fundraiser. Shelter, the National Campaign for Homeless People Limited, registered charity 263710 (England and Wales) and SC002327 (Scotland), registered with the Fundraising Regulator.