Re: Unexplainable execution time difference between two testfunctions...one using IF (SELECT COUNT(*) FROM...) and the other using IFEXISTS (SELECT 1 FROM...) - Mailing list pgsql-performance

From Tomas Vondra
Subject Re: Unexplainable execution time difference between two testfunctions...one using IF (SELECT COUNT(*) FROM...) and the other using IFEXISTS (SELECT 1 FROM...)
Date
Msg-id 3fa6c3a7-e85e-8dc5-35b5-70b06f86ffd0@2ndquadrant.com
Whole thread Raw
In response to Re: Unexplainable execution time difference between two testfunctions...one using IF (SELECT COUNT(*) FROM...) and the other using IFEXISTS (SELECT 1 FROM...)  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: Unexplainable execution time difference between two testfunctions...one using IF (SELECT COUNT(*) FROM...) and the other using IFEXISTS (SELECT 1 FROM...)
List pgsql-performance

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


pgsql-performance by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Unexplainable execution time difference between two testfunctions...one using IF (SELECT COUNT(*) FROM...) and the other using IFEXISTS (SELECT 1 FROM...)
Next
From: Akshay Ballarpure
Date:
Subject: RE: Data migration from postgres 8.4 to 9.4