Re: _bt_check_unique checks every row in table when doing update??

Mats Lofkvist <mal@algonet.se>

From: Mats Lofkvist <mal@algonet.se>
To: pgsql-bugs@postgresql.org
Date: 2002-09-10T07:36:29Z
Lists: pgsql-bugs
tgl@sss.pgh.pa.us (Tom Lane) writes:

> Mats Lofkvist <mal@algonet.se> writes:
> > But when doing ~1000 updates (i.e. setting val0 and val1 with
> > a where on an existing key0/key1/key2 triplet), I get this which
> > seems very strange to me:
> 
> I suppose you repeatedly updated the same row 1000 times?  That creates
> an O(N^2) behavior because the dead tuples have to be rechecked again
> and again.
> 
> 7.3 will be smarter about this.
> 
> 			regards, tom lane


Yes, I did update the same row so your explanation is correct.
(Note that I also read the data wrong, for some reason I read it
as 500k checks per 1 update, not per 1000 which made it look
a lot worse than it is.)

Thanks for the explanation, I'll try 7.3 beta to see how it
works there.

      _
Mats Lofkvist
mal@algonet.se