Search⌘ K

Multiple Values per Column

Explore why having multiple values per column in PostgreSQL tables violates the first normal form and creates challenges like inefficient tag searches and data anomalies. Understand how this anti-pattern complicates querying, maintenance, and normalization, and why adopting proper table models improves data handling and performance.

The multivalued field in a database schema

A table (relation) is in 1NF if:

  • There are no duplicated rows in the table
  • Each cell is single-valued (no repeating groups or arrays)
  • Entries in a column (field) are similar

An anti-pattern that fails to comply with those rules means having a multivalued field in a database schema:

create table tweet
 (
   id      bigint primary key,
   date    timestamptz,
   message text,
   tags    text
 );

Data would then be added with a semicolon separator, for instance, or maybe a pipe | char, or in some cases with a fancy Unicode separator char such as §, , or ¦. Here, we find a classic semicolon:

         id         │ date │ message │          tags
...