pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Pavel Stehule <pavel.stehule@gmail.com>
To: Hackety Man <hacketyman@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Pgsql Performance <pgsql-performance@lists.postgresql.org>
Subject: Re: Unexplainable execution time difference between two test functions...one using IF (SELECT COUNT(*) FROM...) and the other using IF EXISTS (SELECT 1 FROM...)
Date: Tue, 17 Apr 2018 12:52:45 +0200
Message-ID: <3fa6c3a7-e85e-8dc5-35b5-70b06f86ffd0@2ndquadrant.com> (raw)
In-Reply-To: <CAFj8pRA5sS+dxBP8ZiDLMw6KUZKtVGa476cgxe5nJ5K1n43xng@mail.gmail.com>
References: <CA+1fJ+8vEq+RWpgpqgaxjwq1AvnRSrm0FFgN2_8VoRUq7=asMA@mail.gmail.com>
	<CAFj8pRA5sS+dxBP8ZiDLMw6KUZKtVGa476cgxe5nJ5K1n43xng@mail.gmail.com>



On 04/17/2018 07:17 AM, Pavel Stehule wrote:
> Hi
> 
> 2018-04-16 22:42 GMT+02:00 Hackety Man <hacketyman@gmail.com 
> <mailto:hacketyman@gmail.com>>:
> 
> ...
 >
> A support of parallel query execution is not complete -  it doesn't work 
> in PostgreSQL 11 too. So although EXISTS variant can be faster (but can 
> be - the worst case of EXISTS is same like COUNT), then due disabled 
> parallel execution the COUNT(*) is faster now. It is unfortunate, 
> because I believe so this issue will be fixed in few years.
> 

None of the issues seems to be particularly related to parallel query. 
It's much more likely a general issue with planning EXISTS / LIMIT and 
non-uniform data distribution.


regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




view thread (12+ messages)  latest in thread

Message-ID: <3fa6c3a7-e85e-8dc5-35b5-70b06f86ffd0@2ndquadrant.com>
Permalink:  ../3fa6c3a7-e85e-8dc5-35b5-70b06f86ffd0@2ndquadrant.com/
Also on:    postgresql.org/message-id/3fa6c3a7-e85e-8dc5-35b5-70b06f86ffd0@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tomas.vondra@2ndquadrant.com, pavel.stehule@gmail.com, hacketyman@gmail.com, robertmhaas@gmail.com, pgsql-performance@lists.postgresql.org
  Subject: Re: Unexplainable execution time difference between two test functions...one using IF (SELECT COUNT(*) FROM...) and the other using IF EXISTS (SELECT 1 FROM...)
  In-Reply-To: <3fa6c3a7-e85e-8dc5-35b5-70b06f86ffd0@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox