From: Tom Lane <tgl@sss.pgh.pa.us>
To: Campbell, Lance <lance@illinois.edu>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: data model one large and many small columns
Date: Tue, 26 Jul 2016 17:18:08 -0400
Message-ID: <11722.1469567888@sss.pgh.pa.us> (raw)
In-Reply-To: <B75CD08C73BD3543B97E4EF3964B7D703076285B@CITESMBX1.ad.uillinois.edu>
References: <B75CD08C73BD3543B97E4EF3964B7D703076285B@CITESMBX1.ad.uillinois.edu>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>
"Campbell, Lance" <lance@illinois.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
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, lance@illinois.edu
Subject: Re: data model one large and many small columns
In-Reply-To: <11722.1469567888@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox