BUG #14729: Between operator is slow when same value used for low and high margin

From: pavel(dot)tavoda(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14729: Between operator is slow when same value used for low and high margin
Date: 2017-07-03 10:09:23
Message-ID: 20170703100923.1448.48433@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14729
Logged by: Pavel Tavoda
Email address: pavel(dot)tavoda(at)gmail(dot)com
PostgreSQL version: 9.4.10
Operating system: Linux
Description:

When using JOIN with BETWEEN with same value for low and high marging query
is taking more than 40 times longer. Amount of result rows is aroung
20.000.

SELECT count(*) FROM contractportfolio cp JOIN contract co ON cp.contract =
co.id WHERE validfor between '2017-05-30' AND '2017-05-31';
Time: 0.473

SELECT count(*) FROM contractportfolio cp JOIN contract co ON cp.contract =
co.id WHERE validfor between '2017-05-31' AND '2017-05-31';
Time: 19.172

SELECT count(*) FROM contractportfolio cp JOIN contract co ON cp.contract =
co.id WHERE validfor = '2017-05-31';
Time: 0.467

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message foxxy 2017-07-03 12:21:50 BUG #14730: Passing an array of composites to a plpythonu function results in a list of strs
Previous Message yuki 2017-07-03 08:55:24 BUG #14728: Missing "pg_config.h" in the "postgresql96-devel" package