Page MenuHomePhabricator

Gather statements metrics to inform db schema decisions
Open, Needs TriagePublic

Description

We would like to gather some metrics to inform our db schema design decisions.

From T434870#12311884:

  • Total number of statements
  • Number of statements for each data type (item, string, property, etc.)
  • How many distinct values exists for each value type
  • Number of deprecated statements
  • Number of "best ranking" statements.
  • Number of statement in two large group of items: scholarly articles and astronomical objects. So We can assess what would be the impact of excluding them.
  • Number of statements with "no" or "some" value. So we can see how much is needed.

See T434870#12312068 for some initial numbers.

Details

Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
Run the census on the 2026-09-14 snapshotrepos/wmde/wikibase-reuse/wikidata-statement-count!12itamarsummarymain
Trim the notebook and key the cache by snapshotrepos/wmde/wikibase-reuse/wikidata-statement-count!11itamarnotebook-trimmain
Measure statement id forms and column bytesrepos/wmde/wikibase-reuse/wikidata-statement-count!10itamaridentity-guidmain
Answer the review round on !1, !3 and !5repos/wmde/wikibase-reuse/wikidata-statement-count!9itamarreview-roundmain
Count novalue and somevalue per data typerepos/wmde/wikibase-reuse/wikidata-statement-count!8itamarsnak-typesmain
Fold the categories metric into the subject flags cellrepos/wmde/wikibase-reuse/wikidata-statement-count!7itamarcategoriesmain
Measure statements per rankrepos/wmde/wikibase-reuse/wikidata-statement-count!6itamarby-rankmain
Measure distinct values and pairs per value typerepos/wmde/wikibase-reuse/wikidata-statement-count!5itamardistinct-valuesmain
Read subject flags from the statements tablerepos/wmde/wikibase-reuse/wikidata-statement-count!4itamarspeed-optimizationmain
First three metrics of the census on the flattened statements tablerepos/wmde/wikibase-reuse/wikidata-statement-count!3itamarmetric-totalmain
Flatten statements into an Iceberg tablerepos/wmde/wikibase-reuse/wikidata-statement-count!2itamarflatten-passmain
Subject flags and class list for the statement censusrepos/wmde/wikibase-reuse/wikidata-statement-count!1itamarsubject-flagsmain
Show related patches Customize query in GitLab

Event Timeline

Snapshot 2026-09-14, item statements only, one row per main snak. Full tables in the rendered notebook and the result CSVs.

  • Size: 1.78 billion item statements on 121 million items; 97.8% best-ranked, 0.7% deprecated; within 0.5% of the WDQS graph split total on T434870.
  • Exclusions: scholarly articles (WDQS rule) are 55.5% of statements on 38.0% of items; astronomical objects 8.5%; without both, 641 million statements (36%) remain.
  • Value kinds: entity values 49.6%, strings 35.6%, quantities 6.0%, time 4.2%; novalue and somevalue together 1.1 million (0.06%).
  • Repetition: 95% of entity values and 99.5% of time values occur on more than one statement; strings 53%, and 29% once scholarly articles are out.
  • Ranks: 0.37% preferred, 98.9% normal; the preferred total on T434870 reads 6,373,097 but its cells sum to 6,494,097; this snapshot counts 6,495,384 (6,361,245 main, 134,139 scholarly).
  • Identity: 91.2% of statement ids are the minted form (uppercase uuid), 7.9% lowercase uuids, 0.9% lowercase prefixes; 51 ids are not uuids at all, 4 ids are duplicated, and only (subject id, statement id) is unique. Wikibase never validates the uuid part.
  • Identity bytes: 107 GB at 60 bytes per row, 28 GB at 16 (best-ranked only: 104 and 28).
  • Caveats: 1 statement with a missing datatype; 33 statements on 2 items are both scholarly and astronomical.