From: | M Q <thekaib(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-novice(at)postgresql(dot)org |
Subject: | Re: "where x between y and z" for timestamp data types |
Date: | 2012-08-13 06:27:52 |
Message-ID: | CAGnP9ZjPE9qNF1XTt8X-3tHJ2Cin6gpPpkXVVvTbXr6rBNQg1w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
The 'date' field is a timestamp without timezone. The upper and lower
bounds of the BETWEEN are identical just for testing purposes. Any range
would do.
I'm having trouble reproducing the problem on a similar data set. I
created a new db, same table schema, same row count with randomly generated
data for testing but the function works fine. So perhaps my problem is
related to the tables rather than the function. If I can successfully
reproduce the problem with another data set I'll send example code to
share. I'll also look into the links you gave me.
Thanks,
Kaib
On Sun, Aug 12, 2012 at 2:28 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Jeff Davis <pgsql(at)j-davis(dot)com> writes:
> > I briefly tried your example and I didn't see a problem. Can you provide
> > some sample data that illustrates your problem? Also, is the "date"
> > field a date or a timestamp? And why are the upper and lower bounds of
> > the BETWEEN identical?
>
> I'll bet a nickel the planner is choosing a different plan when it
> doesn't know that the timestamp range condition is extremely selective.
>
> regards, tom lane
>
From | Date | Subject | |
---|---|---|---|
Next Message | Philippe Dirkse | 2012-08-13 07:56:37 | Need help importing dump with bytea into db |
Previous Message | Jeff Davis | 2012-08-12 22:29:46 | Re: Joining time fields? |