data model one large and many small columns

From: "Campbell, Lance" <lance(at)illinois(dot)edu>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: data model one large and many small columns
Date: 2016-07-26 20:22:04
Message-ID: B75CD08C73BD3543B97E4EF3964B7D703076285B@CITESMBX1.ad.uillinois.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

PostgreSQL 9.5.3

Suppose you have a table that consists of a lot of small sized columns with one really large text column. The text column represents an average sized web page. When inserting or updating you will work with only one row at a time.

When selecting information you will either:

A) select all columns in one row for display or editing purposes.

B) Or you will select hundreds of rows but NOT the very large text column.

Question: Is there any performance to be gained from PostgreSQL by storing the data as two tables versus one table? In the two table model you would put the large column in a secondary table with a foreign key back to the primary table. So each table would have a one to one relationship. In the two table model when you need a single record with everything you would select from both tables based on a key. When selecting hundreds of rows at one time you would only select from the primary table.

I know there is this concept of TOAST. I don't know if it even matters to PostgreSQL if I had two separate tables or just one.

Thanks for your insight.

Lance

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Whitney 2016-07-26 21:00:35 Re: data model one large and many small columns
Previous Message Kevin Grittner 2016-07-26 19:50:46 Re: Database 'template1' vacuum