Which is faster: BETWEEN or 2 WHERE statements?

From: Chuck Roberts <croberts(at)gilsongraphics(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Which is faster: BETWEEN or 2 WHERE statements?
Date: 2015-02-17 13:04:29
Message-ID: 11ce83be23d519810420717592ceab78@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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.

Thank you!

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Thom Brown 2015-02-17 13:17:25 Re: Which is faster: BETWEEN or 2 WHERE statements?
Previous Message Lacey Powers 2015-02-15 20:41:28 Re: How to create tables and copy records in blocks?