Re: Load TIME fields - proposed performance improvement - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Load TIME fields - proposed performance improvement
Date
Msg-id 1136659.1600742667@sss.pgh.pa.us
Whole thread Raw
In response to Re: Load TIME fields - proposed performance improvement  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Load TIME fields - proposed performance improvement  (Peter Smith <smithpb2250@gmail.com>)
List pgsql-hackers
I wrote:
> Interesting idea, but this implementation is leaving a *lot*
> on the table.  If we want to cache the result of
> timestamp2tm applied to GetCurrentTransactionStartTimestamp(),
> there are half a dozen different call sites that could make
> use of such a cache, eg, GetSQLCurrentDate and GetSQLCurrentTime.

As an example, I did some quick-and-dirty "perf" measurement of
this case:

create table t1 (id int, d date default current_date);
insert into t1 select generate_series(1,100000000);

and found that about 10% of the runtime is spent inside timestamp2tm().
Essentially all of that cost could be removed by a suitable caching
patch.  Admittedly, this is a pretty well cherry-picked example, and
more realistic test scenarios might see just a percent or two win.
Still, for the size of the patch I'm envisioning, it'd be well
worth the trouble.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Load TIME fields - proposed performance improvement
Next
From: Andres Freund
Date:
Subject: Re: shared-memory based stats collector