speedup tidbitmap patch: cache page - Mailing list pgsql-hackers

From Teodor Sigaev
Subject speedup tidbitmap patch: cache page
Date
Msg-id 54479A85.8060309@sigaev.ru
Whole thread Raw
Responses Re: speedup tidbitmap patch: cache page
List pgsql-hackers
In specific workload postgres could spend a lot of time in tbm_add_tuples,  up
to 50% of query time. hash_search call is expensive and called twice for each
ItemPointer to insert. Suggested patch tries to cache last PagetableEntry
pointer in hope that next ItemPointer will be on the same relation page.

Patch is rather trivial and I don't believe that it could cause performance
degradation. But it could increase performance on some workload.

An example:
# create extension btree_gin;
# select (v / 10)::int4 as i into t from generate_series(1, 5000000) as v;
# create index idx on t using gin (i);
# set enable_seqscan  = off;

# explain analyze select * from t where i >= 0;
without patch: Execution time: 2427.692 ms
with patch:    Execution time: 2058.718 ms

# explain analyze select * from t where i >= 100 and i<= 100;
without patch: Execution time: 524.441 ms
with patch:    Execution time: 195.381 ms
--
Teodor Sigaev                                   E-mail: teodor@sigaev.ru
                                                    WWW: http://www.sigaev.ru/

Attachment

pgsql-hackers by date:

Previous
From: Marti Raudsepp
Date:
Subject: Re: btree_gin and ranges
Next
From: Heikki Linnakangas
Date:
Subject: Re: BUG: *FF WALs under 9.2 (WAS: .ready files appearing on slaves)