Re: Which is faster: BETWEEN or 2 WHERE statements?

Поиск
Список
Период
Сортировка
От Thom Brown
Тема Re: Which is faster: BETWEEN or 2 WHERE statements?
Дата
Msg-id CAA-aLv52NZMKXgtnxW7Z0NQA9sx8v7o0Xb53t_LdTG-XuZ_T8w@mail.gmail.com
обсуждение исходный текст
Ответ на Which is faster: BETWEEN or 2 WHERE statements?  (Chuck Roberts <croberts@gilsongraphics.com>)
Список pgsql-novice
On 17 February 2015 at 13:04, Chuck Roberts <croberts@gilsongraphics.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

В списке pgsql-novice по дате отправления:

Предыдущее
От: Chuck Roberts
Дата:
Сообщение: Which is faster: BETWEEN or 2 WHERE statements?
Следующее
От: Hans Ginzel
Дата:
Сообщение: copy from pipe