From: Yves Vindevogel <yves.vindevogel@implements.be>
To: Jeffrey W. Baker <jwbaker@acm.org>
Cc: pgsql-performance@postgresql.org
Subject: Re: (Re)-indexing on updates
Date: Mon, 22 Aug 2005 11:11:25 +0200
Message-ID: <72e7fd0cfc36da6420ba0e92a390b561@implements.be> (raw)
In-Reply-To: <1124651165.5990.1.camel@noodles>
References: <ba89fec2b148abbc137d9a9b8e2832c7@implements.be>
<1124651165.5990.1.camel@noodles>
The option with
T1: A B C and T2 A D (to avoid the updates)
works very well with a simple query
Insert into T2 (A, D)
select A, functionToGetD from T1 left join T2 on T1.A = T2.A
where T2.A is null
The above gives me the new records for those where D was not filled yet.
Since they are all new records, I have no trouble with the MVCC
On 21 Aug 2005, at 21:06, Jeffrey W. Baker wrote:
> On Sun, 2005-08-21 at 20:32 +0200, Yves Vindevogel wrote:
>>
>>
>> ______________________________________________________________________
>>
>> Hi,
>>
>> Say I have a table with column A, B, C, D
>> A has a unique index on it (primary key)
>> B and C have a normal index on it
>> D has no index
>>
>> If I perform a query like update tbl set D = 'whatever' ;
>> that should make no difference on the indexes on the other columns,
>> right ?
>
> What postgresql does on update is to make a new record, so there will
> be
> two records in your table and two records in your index. You would
> need
> to vacuum the table to mark the space for the old record free, and you
> would need to reindex the table to shrink the index.
>
>>
>> Or is there some kind of mechanism that does create a sort of new
>> record, thus makes the indexes go wild.
>
> Yes.
>
> -jwb
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
>
>
Met vriendelijke groeten,
Bien à vous,
Kind regards,
Yves Vindevogel
Implements
Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91
Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76
Web: http://www.implements.be
First they ignore you. Then they laugh at you. Then they fight you.
Then you win.
Mahatma Ghandi.
Attachments:Pasted Graphic 2.tiff (image/tiff, 5.6K) downloadview image
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: yves.vindevogel@implements.be, jwbaker@acm.org
Subject: Re: (Re)-indexing on updates
In-Reply-To: <72e7fd0cfc36da6420ba0e92a390b561@implements.be>
* 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