From: | Thom Brown <thom(at)linux(dot)com> |
---|---|
To: | Chuck Roberts <croberts(at)gilsongraphics(dot)com> |
Cc: | PostgreSQL List - Novice <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Which is faster: BETWEEN or 2 WHERE statements? |
Date: | 2015-02-17 13:17:25 |
Message-ID: | CAA-aLv52NZMKXgtnxW7Z0NQA9sx8v7o0Xb53t_LdTG-XuZ_T8w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On 17 February 2015 at 13:04, Chuck Roberts <croberts(at)gilsongraphics(dot)com>
wrote:
> Psql 8.4
>
>
>
> Which will help the query run faster on my version of Psql;
>
>
>
> 1) WHERE (mydate >= '2015-01-01') AND (mydate<='2015-01-31')
>
>
>
> 2) WHERE (mydate BETWEEN '2015-01-01' AND '2015-01-31')
>
>
>
> I'm just curious. We have 500,000+ records to go through on this one
> table, and query involves 2 tables. The date field 'mydate' is not indexed.
>
The planner will convert the 2nd clause to be the same as the 1st, so there
should be no difference in the resulting plans.
Run EXPLAIN <query> and see what query plan you get for each.
Regards
Thom
From | Date | Subject | |
---|---|---|---|
Next Message | Hans Ginzel | 2015-02-17 19:43:11 | copy from pipe |
Previous Message | Chuck Roberts | 2015-02-17 13:04:29 | Which is faster: BETWEEN or 2 WHERE statements? |