X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DF2519DCAEE for ; Mon, 20 Mar 2006 18:56:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96464-05 for ; Mon, 20 Mar 2006 18:56:41 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from amanda.contactbda.com (ipn36372-f65123.cidr.lightship.net [216.204.66.227]) by postgresql.org (Postfix) with ESMTP id C341C9DC9C0 for ; Mon, 20 Mar 2006 18:56:37 -0400 (AST) Received: from amanda.contactbda.com (amanda.contactbda.com [192.168.1.2]) by amanda.contactbda.com (8.12.11/8.12.11/Debian-3) with ESMTP id k2KMuY0O003868; Mon, 20 Mar 2006 17:56:34 -0500 From: "Jim Buttafuoco" To: "Craig A. James" , pgsql-performance@postgresql.org Reply-To: jim@contactbda.com Subject: Re: update == delete + insert? Date: Mon, 20 Mar 2006 17:56:34 -0500 Message-Id: <20060320225614.M93465@contactbda.com> In-Reply-To: <441F3187.90506@modgraph-usa.com> References: <7F10D26ECFA1FB458B89C5B4B0D72C2B088286@sesrv12.wirelesscar.com> <441EC652.1010807@modgraph-usa.com> <441F3187.90506@modgraph-usa.com> X-Mailer: Open WebMail 2.41 20040926 X-OriginatingIP: 192.168.1.1 (jim) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.124 required=5 tests=[AWL=0.124] X-Spam-Score: 0.124 X-Spam-Level: X-Archive-Number: 200603/353 X-Sequence-Number: 17790 go with design 1, update does = delete + insert. ---------- Original Message ----------- From: "Craig A. James" To: pgsql-performance@postgresql.org Sent: Mon, 20 Mar 2006 14:49:43 -0800 Subject: [PERFORM] update == delete + insert? > I've seen it said here several times that "update == delete + insert". On the other hand, I've noticed that > "alter table [add|drop] column ..." is remarkably fast, even for very large tables, which leads me to wonder > whether each column's contents are in a file specifically for that column. > > My question: Suppose I have a very "wide" set of data, say 100 columns, and one of those columns will be > updated often, but the others are fairly static. I have two choices: > > Design 1: > create table a ( > id integer, > frequently_updated integer); > > create table b( > id integer, > infrequently_updated_1 integer, > infrequently_updated_2 integer, > infrequently_updated_3 integer, > ... etc. > infrequently_updated_99 integer); > > Design 2: > create table c( > id integer, > frequently_updated integer, > infrequently_updated_1 integer, > infrequently_updated_2 integer, > infrequently_updated_3 integer, > ... etc. > infrequently_updated_99 integer); > > If "update == delete + insert" is strictly true, then "Design 2" would be poor since 99 columns would be moved > around with each update. But if columns are actually stored in separate files, the Designs 1 and 2 would be > essentially equivalent when it comes to vacuuming. > > Thanks, > Craig > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend ------- End of Original Message -------