Re: pgsql: Allow HOT updates for some expression indexes

From: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Allow HOT updates for some expression indexes
Date: 2018-03-28 07:44:28
Message-ID: 87aff695-b6de-c873-cbc6-d104f86d9e7c@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On 28.03.2018 07:23, Simon Riggs wrote:
> On 27 March 2018 at 22:26, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> I wrote:
>>> The test script appears to imagine that pgstats outputs update
>>> instantaneously.
>> Oh, wait, it's looking at pg_stat_xact, which is the *local*, unsent
>> stats information. So your problem is actually the reverse of that:
>> if the test runs too slowly, it fails, because at some point the
>> unsent stats information will get flushed out to the collector and
>> disappear from the pg_stat_xact view.
>>
>> You could probably make this more reliable by wrapping each test
>> stanza in a transaction, ie instead of
>>
>> create table keyvalue ...;
>> ... do something to table ...
>> select pg_stat_get_xact_tuples_hot_updated('keyvalue'::regclass);
>> drop table keyvalue;
>>
>> do
>>
>> begin;
>> create table keyvalue ...;
>> ... do something to table ...
>> select pg_stat_get_xact_tuples_hot_updated('keyvalue'::regclass);
>> rollback;
>>
>> (no need for a DROP if you're rolling it all back)
> Oh wow, thanks. Fixed.
>

I am sorry, I missed the fact that local stat information can be reset.
Attached please find updated version of the patch with func_index.sql
test fixed.
Also I have renamed rd_indexattr to rd_nprjindexattr to avoid confusions.

--
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
projection-8.patch text/x-patch 28.6 KB

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Pavan Deolasee 2018-03-28 09:14:44 Re: pgsql: Optimize btree insertions for common case of increasing values
Previous Message Andrew Dunstan 2018-03-28 06:37:46 pgsql: Make fast_default regression tests locale independent