Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y3Aju-0007D3-Ax for pgsql-performance@arkaria.postgresql.org; Mon, 22 Dec 2014 21:42:06 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Y3Ajt-0005Ml-M5 for pgsql-performance@arkaria.postgresql.org; Mon, 22 Dec 2014 21:42:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Y3Ajs-0005Kc-AT for pgsql-performance@postgresql.org; Mon, 22 Dec 2014 21:42:04 +0000 Received: from relay5-d.mail.gandi.net ([2001:4b98:c:538::197]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Y3Ajp-0006Gd-1V for pgsql-performance@postgresql.org; Mon, 22 Dec 2014 21:42:03 +0000 Received: from mfilter20-d.gandi.net (mfilter20-d.gandi.net [217.70.178.148]) by relay5-d.mail.gandi.net (Postfix) with ESMTP id A4C4741C05C; Mon, 22 Dec 2014 22:41:57 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter20-d.gandi.net Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by mfilter20-d.gandi.net (mfilter20-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id yv5RwaaXjviW; Mon, 22 Dec 2014 22:41:56 +0100 (CET) X-Originating-IP: 98.27.58.255 Received: from [192.168.10.146] (cpe-098-027-058-255.nc.res.rr.com [98.27.58.255]) (Authenticated sender: adsend@dunslane.net) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id ECE9541C05A; Mon, 22 Dec 2014 22:41:55 +0100 (CET) Message-ID: <54989022.9010305@dunslane.net> Date: Mon, 22 Dec 2014 16:41:54 -0500 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Robert DiFalco , "pgsql-performance@postgresql.org" Subject: Re: Number of Columns and Update References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 12/22/2014 03:53 PM, Robert DiFalco wrote: > This may fall into the category of over-optimization but I've become > curious. > > I have a user table with about 14 columns that are all 1:1 data - so > they can't be normalized. > > When I insert a row all columns need to be set. But when I update, I > sometimes only update 1-2 columns at a time. Does the number of > columns impact update speed? > > For example: > UPDATE users SET email = ? WHERE id = ?; > > I can easily break this up into logical tables like user_profile, > user_credential, user_contact_info, user_summary, etc with each table > only having 1-4 columns. But with the multiple tables I would often be > joining them to bring back a collection of columns. > > I know I'm over thinking this but I'm curious of what the performance > trade offs are for breaking up a table into smaller logically grouped > tables. > > An update rewrites the whole row, not just the updated columns. I think you are overthinking it. cheers andrew -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance