From other answers on many columns vs many rows (or tables) it seems columns are more performant for normalized data. What about serialized data?
I'm going to store many in-progress web forms, i.e. not yet validated just a dump of what the user has so far so they can continue in another session. The forms will be serialized as json and stored in a jsonb column. There are currently ten forms but (many) more will be added in the future.
Is it better to have one column with a user id and a column for each form:
CREATE TABLE "forms" (
"user_id" uuid NOT NULL,
"form_a" jsonb,
"form_b" jsonb,
"form_c" jsonb,
...
)
or many rows with a user uuid, form id, and form json columns:
CREATE TABLE "forms" (
"user_id" uuid NOT NULL,
"form_id" uuid NOT NULL,
"form_json" jsonb NOT NULL
)
I'm sure querying for just one row is faster, but what about updating a column in a row with many jsonb columns? or adding a new jsonb column to a table with millions of rows? At what point does it tip to favoring many rows?
thanks!