Re: Update violating constraint

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: Naz Gassiep <naz(at)mira(dot)net>, Michael Glaesemann <grzm(at)seespotcode(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Update violating constraint
Date: 2007-05-03 14:00:25
Message-ID: 194540.41655.qm@web31810.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> > update foo
> > set field = -1 * (field + 1);
> > update foo
> > set field = -1 * field
> > where field < 0;
> >
> Yes, in fact I actually use option one already in the handling of sql
> trees, so I'm annoyed with myself for not figuring that out. I don't
> know why you'd ever use your second option ever, as it virtually
> guarantees problems at a random point in your DB's growth.

If you are updating a large portion of your tree, you will probably want to throw in a vacuum in
between the two updates. This should reduce the bloat caused by dead tuples in both your index
and table.

Regards,
Richard Broersma Jr.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Csaba Nagy 2007-05-03 14:06:52 Re: Update violating constraint
Previous Message Stephen Harris 2007-05-03 13:57:12 Re: Have I b0rked something? Slow comparisons on "where x in (...)"