Re: Since '2001-09-09 01:46:40'::timestamp microseconds are lost when extracting epoch

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Steele <david(at)pgmasters(dot)net>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Petr Fedorov <petr(dot)fedorov(at)phystech(dot)edu>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Since '2001-09-09 01:46:40'::timestamp microseconds are lost when extracting epoch
Date: 2021-03-22 20:58:20
Message-ID: fcb54768-3d0a-d742-4bdb-4f2cef43d094@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers


On 19.03.21 21:06, Tom Lane wrote:
> I guess the immediate question is how much of a performance gap there
> is now between the float and numeric implementations.

Attached are my test script and the full output.

To summarize, for cases that don't do any interesting computation and
where the overhead is only the data type passing, the difference is like
this:

-- old
select date_part('microseconds', current_timestamp + generate_series(0,
10000000) * interval '1 second') \g /dev/null
Time: 2760.966 ms (00:02.761)

-- new
select extract(microseconds from current_timestamp + generate_series(0,
10000000) * interval '1 second') \g /dev/null
Time: 3178.477 ms (00:03.178)

Attachment Content-Type Size
output.txt text/plain 21.7 KB
test.sql text/plain 16.9 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Scott 2021-03-22 23:59:48 Multiple Values Inserts for Generated Columns Erroring Out
Previous Message Tom Lane 2021-03-22 18:22:48 Re: BUG #16938: Duplicate records with same Primary Key

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2021-03-22 21:07:07 Re: proposal - psql - use pager for \watch command
Previous Message Robert Haas 2021-03-22 20:57:18 Re: [HACKERS] Custom compression methods