Re: heap-only tuples, and constraints

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: "maxxedit(at)gmail(dot)com" <maxxedit(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: heap-only tuples, and constraints
Date: 2010-08-19 01:48:29
Message-ID: 1282182509.31353.24.camel@jdavis-ux.asterdata.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 2010-08-14 at 00:29 -0700, maxxedit(at)gmail(dot)com wrote:
> Does this statement (UPDATE user SET email='newChangedVal',
> password='existingVal') requires updating an index on user.password?
> Or more generally, if an UPDATE includes an explicit but unchanged
> value for an index column, does postgres need to also update the index
> entries? Or does HOT apply only when indexed column is missing or not
> explicit (i.e. password=password)?

It does a binary comparison of the old/new values (for indexed columns),
and if they are identical, it allows a HOT update.

If a data type has two representations for the same value, that may mean
that it does a regular update when it could do a hot update. In other
words, it doesn't call a datatype-specific equality function.

> Along the same line of thought as above, if password is a foreign key
> column and if an UPDATE includes an explicit but unchanged value for
> this fk column, does postgres need to check constraint satisfiability?

No, it does not need to do the check.

In this case, however, it does appear that it uses a datatype-specific
equality function. So, even if you have a strange datatype where two
equal values can have different representations, it will still avoid the
check.

Regards,
Jeff Davis

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeremy Palmer 2010-08-19 02:13:47 Re: Win32 Backend Cash - pre-existing shared memory block is still in use
Previous Message Joshua D. Drake 2010-08-18 23:58:08 Re: Massively Parallel transactioning?