Field note · June 5, 2023

Reading priority before trusting it in support-tickets

4,000 rows, 4 distinct values, and the one fact about priority that changes how you query it.

1 min read ·Data quality ·quality practice

Profiling priority on support-tickets before anyone builds anything on top of it.

4,000 rows, no nulls, 4 distinct values. low, normal, high, or urgent.

4 values, and they are not evenly spread: normal 48.4%, high 22.6%, low 21.6%, urgent 7.4%. The largest takes 48.4% on its own.

Read the distinct list rather than the distinct count. Casing differences and trailing whitespace produce values that look identical in a report and group separately in SQL, and the count will not show you that — select distinct priority order by 1 will, in about a second.

sql
select
  count(*)                   as rows,
  count(priority)            as present,
  count(*) - count(priority) as nulls,
  count(distinct priority)   as distinct_values
from support_tickets;

Low cardinality, stable values — this is a column you can group by without thinking about it, and a reasonable candidate for a chart facet. Check the distinct list, not just the count, because a stray casing variant hides in the count and shows up in the group-by.

Where this bites: a group-by on this column produces 4 rows today. If it is a column an upstream system can add values to, it produces an unknown number tomorrow, and any dashboard laid out for 4 categories reflows without warning. Values arriving is a schema change that no schema check catches.

The grain is one row per ticket, which is the context every one of those numbers depends on. None of them survive a change of grain, which is why "profile the column" and "profile the table" are the same job. Full schema, and the CSV, on the dataset page.