From: Andrew Dunstan <andrew@dunslane.net>
To: Robert DiFalco <robert.difalco@gmail.com>
To: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Number of Columns and Update
Date: Mon, 22 Dec 2014 16:41:54 -0500
Message-ID: <54989022.9010305@dunslane.net> (raw)
In-Reply-To: <CAAXGW-xXFDWHEBJExt40bWD1+vOo6_UbytCUjEe625GqBXmxUA@mail.gmail.com>
References: <CAAXGW-xXFDWHEBJExt40bWD1+vOo6_UbytCUjEe625GqBXmxUA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>
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
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-performance@postgresql.org
Cc: andrew@dunslane.net, robert.difalco@gmail.com
Subject: Re: Number of Columns and Update
In-Reply-To: <54989022.9010305@dunslane.net>
* 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