From: | "Campbell, Lance" <lance(at)illinois(dot)edu> |
---|---|
To: | "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: data model one large and many small columns |
Date: | 2016-07-26 21:24:42 |
Message-ID: | B75CD08C73BD3543B97E4EF3964B7D70307662C8@CITESMBX1.ad.uillinois.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
I had a hunch this was the case. I just wanted to double check.
Lance
-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Tuesday, July 26, 2016 4:18 PM
To: Campbell, Lance <lance(at)illinois(dot)edu>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: [ADMIN] data model one large and many small columns
"Campbell, Lance" <lance(at)illinois(dot)edu> writes:
> 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?
No, probably not; TOAST will effectively do that for you by off-loading the large text values into the side table.
If you were to do an explicit join, there would be some use-cases --- mainly where you were selecting a LOT of rows --- where in theory you could get a smarter plan from the explicit join. TOAST will effectively always fetch the text values via a nestloop-with-inner-indexscan plan, but maybe hashing or merging would be smarter. Unfortunately, with two explicit tables, TOAST would still apply to the second table, which means that what you've really got under the hood is a three-way join, with the intermediate table contributing nothing except overhead.
So don't bother ...
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2016-07-26 23:11:29 | Re: Pg-Upgrade standbys via rsync... and avoid sending UNlogged data? |
Previous Message | Tom Lane | 2016-07-26 21:18:08 | Re: data model one large and many small columns |