Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g8QAj-0001C2-8S for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Oct 2018 13:29:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g8QAh-0000tf-QE for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Oct 2018 13:29:35 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g8QAh-0000tX-A0 for pgsql-hackers@lists.postgresql.org; Fri, 05 Oct 2018 13:29:35 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g8QAd-0005gh-Ho for pgsql-hackers@postgresql.org; Fri, 05 Oct 2018 13:29:34 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id ECC2C21C2B69 for ; Fri, 5 Oct 2018 16:29:28 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.27.200] (gw.postgrespro.ru [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id BFE2121C2B68 for ; Fri, 5 Oct 2018 16:29:28 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1538746168; bh=1TTI9bSuQOguzX+7RhJI1UHY/mMcUT3i64tupH6bs0E=; h=To:From:Subject:Date; b=LoqfEEVim8n5uAtPXC8bJ07RRD/a3B1G/A/QXaNx4Ka1jnuLUgSMcqIk+VulUQlKa gzrH8vlsEKpBBmOPZUklxYB7XqgXCf6DNv19zeRDDSF/uHyyl8VZytJymJRnGQmnZk EAVDuIRBVr2W2enFhZSVu3PJ269oKnlVCT8oA2WQ= To: PostgreSQL Hackers From: Konstantin Knizhnik Subject: now() vs transaction_timestamp() Message-ID: <6406dbd2-5d37-4cb6-6eb2-9c44172c7e7c@postgrespro.ru> Date: Fri, 5 Oct 2018 16:29:28 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------36DC3BAA29162221E2CC955B" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------36DC3BAA29162221E2CC955B Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Postgres documentation says that |"now()| is a traditional PostgreSQL equivalent to |transaction_timestamp()|". Also both use the same implementation. But them have different parallel safety property: postgres=# \df+ now List of functions    Schema   | Name |     Result data type     | Argument data types | Type | Volatility |  Parallel  |  Owner   | Security | Access privileges | Language |  Source code |       Description ------------+------+--------------------------+---------------------+------+------------+------------+----------+----------+-------------------+----------+ -------------+--------------------------  pg_catalog | now  | timestamp with time zone | | func | stable     | restricted | knizhnik | invoker |                   | internal |  now         | current transaction time (1 row) postgres=# \df+ transaction_timestamp List of functions    Schema   |         Name          |     Result data type     | Argument data types | Type | Volatility | Parallel |  Owner   | Security | Access privileg es | Language | Source code |       Description ------------+-----------------------+--------------------------+---------------------+------+------------+----------+----------+----------+---------------- ---+----------+-------------+--------------------------  pg_catalog | transaction_timestamp | timestamp with time zone |                     | func | stable     | safe     | knizhnik | invoker  |    | internal | now         | current transaction time (1 row) As a result using now() in query disable parallel execution while transaction_timestamp allows it. Was it done intentionally or it is just a bug? -- Konstantin Knizhnik Postgres Professional: http://www.postgrespro.com The Russian Postgres Company --------------36DC3BAA29162221E2CC955B Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Postgres documentation says that "now() is a traditional PostgreSQL equivalent to transaction_timestamp()".
Also both use the same implementation.
But them have different parallel safety property:

postgres=# \df+ now 
                                                                                         List of functions
   Schema   | Name |     Result data type     | Argument data types | Type | Volatility |  Parallel  |  Owner   | Security | Access privileges | Language |
 Source code |       Description       
------------+------+--------------------------+---------------------+------+------------+------------+----------+----------+-------------------+----------+
-------------+--------------------------
 pg_catalog | now  | timestamp with time zone |                     | func | stable     | restricted | knizhnik | invoker  |                   | internal |
 now         | current transaction time
(1 row)

postgres=# \df+ transaction_timestamp
                                                                                                List of functions
   Schema   |         Name          |     Result data type     | Argument data types | Type | Volatility | Parallel |  Owner   | Security | Access privileg
es | Language | Source code |       Description       
------------+-----------------------+--------------------------+---------------------+------+------------+----------+----------+----------+----------------
---+----------+-------------+--------------------------
 pg_catalog | transaction_timestamp | timestamp with time zone |                     | func | stable     | safe     | knizhnik | invoker  |               
   | internal | now         | current transaction time
(1 row)

As a result using now() in query disable parallel execution while transaction_timestamp allows it.
Was it done intentionally or it is just a bug?

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