Re: "where x between y and z" for timestamp data types - Mailing list pgsql-novice

From M Q
Subject Re: "where x between y and z" for timestamp data types
Date
Msg-id CAGnP9ZjPE9qNF1XTt8X-3tHJ2Cin6gpPpkXVVvTbXr6rBNQg1w@mail.gmail.com
Whole thread Raw
In response to Re: "where x between y and z" for timestamp data types  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@sss.pgh.pa.us> wrote:
Jeff Davis <pgsql@j-davis.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

pgsql-novice by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Joining time fields?
Next
From: Philippe Dirkse
Date:
Subject: Need help importing dump with bytea into db