Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 5 of 5 total |
Shortcut boolean evaluation |
Sun, Jul 11 2010 10:07 AM | Permanent Link |
Roy Lambert NLH Associates 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 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. 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 AM | Permanent Link |
Roy Lambert NLH Associates 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 AM | Permanent Link |
David Cornelius Cornelius Concepts | 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 AM | Permanent Link |
Roy Lambert NLH Associates 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 |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |