Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread between optimization
Wed, May 31 2006 1:29 PMPermanent Link

"Jose Eduardo Helminsky"
Tim

I've realized that SQL with between is more optimized than >= and <= dates.
Am I right ?

Examples:
select * from table where dat >= '2006-01-01' and dat <= '2006-01-31'
and
select * from table where dat between '2006-01-01' and '2006-01-31'

Eduardo

Thu, Jun 1 2006 2:47 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Eduardo,

<< I've realized that SQL with between is more optimized than >= and <=
dates.  Am I right ? >>

Yes.  BETWEEN can do the index scan in one shot, whereas the ANDed version
requires two index scans.

--
Tim Young
Elevate Software
www.elevatesoft.com



Fri, Jun 2 2006 3:04 PMPermanent Link

"Jose Eduardo Helminsky"
Tim

Ok, I stayed happy with you answer.

Thanks

Eduardo

Image