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

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: pavel(dot)tavoda(at)gmail(dot)com
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14729: Between operator is slow when same value used for low and high margin
Date: 2017-07-03 14:22:12
Message-ID: CAFj8pRC85hYM=N_d-jxsq9hjMh0FPcsjjnTb3uLpTh3jM8JQsw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi

2017-07-03 12:09 GMT+02:00 <pavel(dot)tavoda(at)gmail(dot)com>:

> 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
>

Please show result of EXPLAIN ANALYZE your query

Regards

Pavel

>
>
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Pavel Tavoda 2017-07-03 14:39:01 Re: BUG #14729: Between operator is slow when same value used for low and high margin
Previous 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