X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2BC1D5283D for ; Thu, 16 Jun 2005 16:36:23 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31083-01 for ; Thu, 16 Jun 2005 19:36:13 +0000 (GMT) Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) by svr1.postgresql.org (Postfix) with ESMTP id 8678952836 for ; Thu, 16 Jun 2005 16:36:12 -0300 (ADT) Received: from juju.arbash-meinel.com ([12.214.18.81]) by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP id <20050616193609m9100ngufse>; Thu, 16 Jun 2005 19:36:13 +0000 Received: from [192.168.1.11] (mail [192.168.1.1]) by juju.arbash-meinel.com (Postfix) with ESMTP id BFDC655FCA; Thu, 16 Jun 2005 14:36:07 -0500 (CDT) Message-ID: <42B1D4A7.60407@arbash-meinel.com> Date: Thu, 16 Jun 2005 14:36:07 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-1?Q?Veikko_M=E4kinen?= Cc: pgsql-performance@postgresql.org Subject: Re: How does the transaction buffer work? References: <42B1D2DE.4020709@ecom.fi> In-Reply-To: <42B1D2DE.4020709@ecom.fi> X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig43DEAECC775450173E44EF25" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/340 X-Sequence-Number: 12977 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig43DEAECC775450173E44EF25 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Veikko M=E4kinen wrote: > Hey, > > How does Postgres (8.0.x) buffer changes to a database within a=20 > transaction? I need to insert/update more than a thousand rows (mayde=20 > even more than 10000 rows, ~100 bytes/row) in a table but the changes=20 > must not be visible to other users/transactions before every row is=20 > updated. One way of doing this that I thought of was start a=20 > transaction, delete everything and then just dump new data in (copy=20 > perhaps). The old data would be usable to other transactions until I=20 > commit my insert. This would be the fastest way, but how much memory=20 > would this use? Will this cause performance issues on a heavily loaded = > server with too little memory even to begin with :) > Postgres does indeed keep track of who can see what. Such that changes=20 won't be seen until a final commit. If you are trying to insert bulk data, definitely consider COPY. But UPDATE should also be invisible until the commit. So if you are only = changing data, there really isn't any reason to do a DELETE and INSERT.=20 Especially since you'll have problems with foreign keys at the DELETE sta= ge. John =3D:-> > > -veikko --------------enig43DEAECC775450173E44EF25 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCsdSnJdeBCYSNAAMRAlEtAJ9SjVXnBlARTRTCF8QsEhlqFsXrcACfdCoW tczQPVs2jxvqEGY0tM6PdlU= =Bhn2 -----END PGP SIGNATURE----- --------------enig43DEAECC775450173E44EF25--