Re: [RFC] indirect toast tuple support

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: [RFC] indirect toast tuple support
Дата
Msg-id 20130216172210.GB15069@awork2.anarazel.de
обсуждение исходный текст
Ответ на [RFC] indirect toast tuple support  (Andres Freund <andres@2ndquadrant.com>)
Список pgsql-hackers
On 2013-02-16 17:42:31 +0100, Andres Freund wrote:
> +/* ----------
> + * toast_datum_differs -
> + *
> + *  Determine whether two toasted datums are the same and don't have to be
> + *  stored again.
> + * ----------
> + */
> +static bool
> +toast_datum_differs(struct varlena *old_value, struct varlena *new_value)
> +{
> +    Assert(VARATT_IS_EXTERNAL(old_value));
> +    Assert(VARATT_IS_EXTERNAL(new_value));
> +
> +    /* fast path for the common case where we have the toast oid available */
> +    if (VARATT_IS_EXTERNAL_TOAST(old_value) &&
> +        VARATT_IS_EXTERNAL_TOAST(new_value))
> +        return memcmp((char *) old_value, (char *) new_value,
> +                      VARSIZE_EXTERNAL(old_value)) == 0;
> ...
> +    /* compare payload, we're fine with unaligned data */
> +    return memcmp(VARDATA_ANY(old_value), VARDATA_ANY(new_value),
> +                  VARSIZE_ANY_EXHDR(old_value)) == 0;
> +}

Those == need to be !=. Comes from changing the meaning of a function
last minute without an easy way to test (it just uselessly emits a new
toast tuple when nothing changed).

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: JSON Function Bike Shedding
Следующее
От: Kevin Grittner
Дата:
Сообщение: Re: Materialized views WIP patch