Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Shortcut boolean evaluation
Sun, Jul 11 2010 10:07 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim

Will ElevateDB fully evaluate

(SELECT _Monitored FROM MailBoxes WHERE _BoxNo = 44) AND
NOT EXISTS (SELECT * FROM emReadStatus WHERE _fkEMails = _MsgNo and emReadStatus._fkStaff = 'XX') AS _xUnRead,

or will it stop at

(SELECT _Monitored FROM MailBoxes WHERE _BoxNo = 44)

if it returns false?


Its for my email subsystem. I only monitor selected (by the user) mailboxes to see if emails have been read or not. The idea is that most mailboxes will not be monitored (in general terms only the Inbox or others that received mail is directed into) so if a shortcut boolean check is done if "should" be faster.

Roy Lambert
Mon, Jul 12 2010 3:31 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< Will ElevateDB fully evaluate

(SELECT _Monitored FROM MailBoxes WHERE _BoxNo = 44) AND
NOT EXISTS (SELECT * FROM emReadStatus WHERE _fkEMails = _MsgNo and
emReadStatus._fkStaff = 'XX') AS _xUnRead,

or will it stop at

(SELECT _Monitored FROM MailBoxes WHERE _BoxNo = 44)

if it returns false? >>

It will always stop evaluating an AND if the first expression is False.

--
Tim Young
Elevate Software
www.elevatesoft.com
Tue, Jul 13 2010 3:32 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim


>It will always stop evaluating an AND if the first expression is False.

Thanks, I thought it would but just wanted to confirm.

Roy Lambert
Tue, Jul 13 2010 10:18 AMPermanent Link

David Cornelius

Cornelius Concepts

Avatar

Good to know.  I'm glad it works this way!

--
David Cornelius
Cornelius Concepts

On 7/12/2010 12:31 PM, Tim Young [Elevate Software] wrote:
> Roy,
>
> << Will ElevateDB fully evaluate
>
> (SELECT _Monitored FROM MailBoxes WHERE _BoxNo = 44) AND
> NOT EXISTS (SELECT * FROM emReadStatus WHERE _fkEMails = _MsgNo and
> emReadStatus._fkStaff = 'XX') AS _xUnRead,
>
> or will it stop at
>
> (SELECT _Monitored FROM MailBoxes WHERE _BoxNo = 44)
>
> if it returns false? >>
>
> It will always stop evaluating an AND if the first expression is False.
>
Wed, Jul 14 2010 1:09 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

David

>Good to know. I'm glad it works this way!

Me to. In the query that brought it to mind I can check to see if the mail box is monitored (three hundred rows tops) rather than a two key check in a table with potentially many thousand rows. It was pretty fast before but this should speed it up a bit. Difficult to say since sub selects can't be tested in situ but testing them outside it should be a bit faster as the average user scrolls through the mailbox tree.

Roy Lambert
Image