A primary key is the value that uniquely identifies each record in a table: a ticket number, a tag number, an order number. IBM defines it as "a column or columns in a database table with values that uniquely identify each row or record". Other tables refer to it to link records, and every count, join and reconciliation depends on it.
Natural and surrogate keys
Some keys are real-world identifiers, such as a printed ticket number or a tag stapled to a bundle. Others are generated by the system and mean nothing outside it. IBM notes that an "artificially generated primary key is known as a surrogate key". Many systems use a surrogate internally and store the real-world number as an ordinary field.
Where timber keys go wrong
A database won't allow duplicate primary keys. The trouble is the real-world identifiers that link systems, which are often not declared as keys at all. Ticket numbers can restart each year, or run in separate series at each scale house. Tag numbers may be reused when old stock runs out. Stand IDs can be renumbered after a boundary change. Each makes joins between systems quietly wrong.
How standards solve it
Shipping standards build uniqueness into the number itself. The SSCC, used to label pallets and other logistics units, is, in Wikipedia's words, "an 18-digit number used to identify logistics units". It combines "an extension digit, a GS1 company prefix, a serial reference, and a check digit". The company prefix means two firms can't issue the same code.
The same idea works inside a business. A ticket number combined with its site and year is unique where the ticket number alone isn't.
What to check
For each identifier used to join systems, check that it is unique across years, sites and systems, or combine it with something that makes it so. Check how many records fail to join, and why.
What it isn't
A primary key isn't a description: two identical boards still need different keys. Nor does it say whether a record is still current. That depends on its status being kept up to date.
How Quarri works explains the platform as a layer over existing systems, not a migration.
Sources
- IBM, "What is a primary key?": ibm.com
- Wikipedia, "Serial shipping container code": en.wikipedia.org
Quarri is an AI-native data platform for the timber supply chain. It connects buying, production, sales and inventory for forest management, sawmill, wood products and pulp, paper and packaging operators.