Optimizing Query Speeds
- Using the "Include Deceased" checkbox vs using the Deceased? field under Constituent Information
- Using Query type (Constituent, Individual, Organization) vs using the Key Indicator field within the query
- Selecting all the options in "Equals one of..." vs using the option "...is not blank"
Comments
-
First, a couple of cautions: If you use Individual or Organization Query Type rather than Key Indicator, be sure you remember you've done that...especially if you tend to use the same query later. Also, [Equals One Of] and [Is Not Blank] can sometimes return vastly different results!
As to your original question, I've found that it more depends on how complex your criteria are. You can use Merge Queries or work with Query Lists for some fine-tuning, should you prefer working completely within RE.
I usually try to use as few criteria as possible, and then either clean up the data outside of RE or Globally Add an Attribute, then start whittling down the list by adding one or two pieces of criteria at a time to a Query that starts with "Attribute Category equals This List". Once I'm done, I can use Global Change to delete the Attributes, and go into Config to delete the Attribute Category itself. (In my case, I have 5 Attributes for this purpose...with a number in the Attribute Category, so I have them at the ready whenever I need them, and they can hang out for as long as I need them. I do this most often for Appeals, because it's so difficult to edit Appeal Tags once in RE...Package, for example, cannot be Globally Changed and Marketing Segment cannot be Globally Added.)
0 -
I personally have not seen a difference between the two Deceased choices.
Query Type is really a different function than Key Indicator and so I would be very careful about switching those up.
And Jennifer is right! One of vs. Is Blank and give you very different results.
If you that concerned about speeds, you would be better off building a few queries with fewer criteria and merging them. Just be aware that the order in which you merge can also affect your results.0 -
This is a very complex topic with, literally, millions of variables that can affect performance. Both RE and SQL Server have some automatic optimization built in that do a good job in most cases.
Aside from just running tests on the various possibilities you can go to the menu bar View > SQL (or Ctrl+Q) and see what the underlying SQL is.
Looking at just the checkbox options here't a Constituent Query with all boxes checked and no Criteria or Output:SELECT
RECORDS.ID "QRECID"
FROM
DBO.RECORDS AS RECORDS
WHERE
((RECORDS.IS_CONSTITUENT = -1))
Unchecking Deceased gives this:SELECT
RECORDS.ID "QRECID"
FROM
DBO.RECORDS AS RECORDS
WHERE
((RECORDS.IS_CONSTITUENT = -1) AND (RECORDS.DECEASED = 0))
Adding Criteria of "Deceased equals No" gives this:SELECT
CASE RECORDS.DECEASED WHEN 0 THEN 'N' WHEN -1 THEN 'Y' ELSE '' END "Deceased",
RECORDS.ID "QRECID"
FROM
DBO.RECORDS AS RECORDS
WHERE
((RECORDS.DECEASED = 0) AND (RECORDS.IS_CONSTITUENT = -1))
Because the Decease value gets automatically added to the Output (at least that's how I have it set in my Options) it adds additional processing overhead in the Select statement to return a "Y" or "N" in the Results tab instead of a zero or one. This will take a microscopically longer time to process.
If I remove Deceased from the Output the SQL returns to this:SELECT
RECORDS.ID "QRECID"
FROM
DBO.RECORDS AS RECORDS
WHERE
((RECORDS.DECEASED = 0) AND (RECORDS.IS_CONSTITUENT = -1))
Identical to what it was before.
Then there's the Execution Plan tab of the SQL Statement window where you can see some of the initial optimization that's being done:|--Parallelism(Gather Streams)
|--Clustered Index Scan(OBJECT:([Minnesota_Childrens_Museum_RE].[dbo].[RECORDS].[PK__RECORDS__408F9238] AS [RECORDS]), WHERE:([Minnesota_Childrens_Museum_RE].[dbo].[RECORDS].[DECEASED] as [RECORDS].[DECEASED]=(0) AND [Minnesota_Childrens_Museum_RE].[dbo].[RECORDS].[IS_CONSTITUENT] as [RECORDS].[IS_CONSTITUENT]=(-1)))
That's just on the RE end of things. The SQL Server will do still more optimization completely behind the scenes based on it's current state, memory allocated, etc.
If it's something that runs fairly quickly and doesn't have to be run often, I wouldn't worry about it.0 -
John Heizer:
Aside from just running tests on the various possibilities you can go to the menu bar View > SQL (or Ctrl+Q) and see what the underlying SQL is.Just to add to John's post, I think the View > SQL menu option is only available to organisations who have unlocked the optional RODBA module.
0 -
Alan French:
John Heizer:
Aside from just running tests on the various possibilities you can go to the menu bar View > SQL (or Ctrl+Q) and see what the underlying SQL is.Just to add to John's post, I think the View > SQL menu option is only available to organisations who have unlocked the optional RODBA module.True. But just about anyone with a maintenance agreement can get it unlocked (although it can be a pain to do and has to be done per workstation if I remember correctly).
0 -
John Heizer:
That's just on the RE end of things. The SQL Server will do still more optimization completely behind the scenes based on it's current state, memory allocated, etc.
SELECT GIFT.ID "QRECID"
FROM DBO.GIFT AS GIFTLEFT OUTER JOIN DBO.GIFTSPLIT AS GIFT_GiftSplit ON GIFT.ID = GIFT_GiftSplit.GIFTID
LEFT OUTER JOIN DBO.CAMPAIGN AS GIFT_GiftSplit_CAMPAIGN ON GIFT_GiftSplit.CAMPAIGNID = GIFT_GiftSplit_CAMPAIGN.ID
LEFT OUTER JOIN DBO.tmp2425893_477508300_1 AS GIFT_V_GiftAttributes_0_1523 ON GIFT.ID = GIFT_V_GiftAttributes_0_1523.PARENTID
Now, I don't know what that tmp2425893_477508300_1 table or view or whatever is, but I assume it's some kind of temp table or table var or something, because the name changes every time I open up the query and hit ctrl-Q. I wish they'd show where that came from or how it was generated.
0
Categories
- All Categories
- Shannon parent
- shannon 2
- shannon 1
- 21 Advocacy DC Users Group
- 14 BBCRM PAG Discussions
- 89 High Education Program Advisory Group (HE PAG)
- 28 Luminate CRM DC Users Group
- 8 DC Luminate CRM Users Group
- Luminate PAG
- 5.9K Blackbaud Altru®
- 58 Blackbaud Award Management™ and Blackbaud Stewardship Management™
- 409 bbcon®
- 2.1K Blackbaud CRM™ and Blackbaud Internet Solutions™
- donorCentrics®
- 1.1K Blackbaud eTapestry®
- 2.8K Blackbaud Financial Edge NXT®
- 1.1K Blackbaud Grantmaking™
- 527 Education Management Solutions for Higher Education
- 1 JustGiving® from Blackbaud®
- 4.6K Education Management Solutions for K-12 Schools
- Blackbaud Luminate Online & Blackbaud TeamRaiser
- 16.4K Blackbaud Raiser's Edge NXT®
- 4.1K SKY Developer
- 547 ResearchPoint™
- 151 Blackbaud Tuition Management™
- 1 YourCause® from Blackbaud®
- 61 everydayhero
- 3 Campaign Ideas
- 58 General Discussion
- 115 Blackbaud ID
- 87 K-12 Blackbaud ID
- 6 Admin Console
- 949 Organizational Best Practices
- 353 The Tap (Just for Fun)
- 235 Blackbaud Community Feedback Forum
- 55 Admissions Event Management EAP
- 18 MobilePay Terminal + BBID Canada EAP
- 36 EAP for New Email Campaigns Experience in Blackbaud Luminate Online®
- 109 EAP for 360 Student Profile in Blackbaud Student Information System
- 41 EAP for Assessment Builder in Blackbaud Learning Management System™
- 9 Technical Preview for SKY API for Blackbaud CRM™ and Blackbaud Altru®
- 55 Community Advisory Group
- 46 Blackbaud Community Ideas
- 26 Blackbaud Community Challenges
- 7 Security Testing Forum
- 1.1K ARCHIVED FORUMS | Inactive and/or Completed EAPs
- 3 Blackbaud Staff Discussions
- 7.7K ARCHIVED FORUM CATEGORY [ID 304]
- 1 Blackbaud Partners Discussions
- 1 Blackbaud Giving Search™
- 35 EAP Student Assignment Details and Assignment Center
- 39 EAP Core - Roles and Tasks
- 59 Blackbaud Community All-Stars Discussions
- 20 Blackbaud Raiser's Edge NXT® Online Giving EAP
- Diocesan Blackbaud Raiser’s Edge NXT® User’s Group
- 2 Blackbaud Consultant’s Community
- 43 End of Term Grade Entry EAP
- 92 EAP for Query in Blackbaud Raiser's Edge NXT®
- 38 Standard Reports for Blackbaud Raiser's Edge NXT® EAP
- 12 Payments Assistant for Blackbaud Financial Edge NXT® EAP
- 6 Ask an All Star (Austen Brown)
- 8 Ask an All-Star Alex Wong (Blackbaud Raiser's Edge NXT®)
- 1 Ask an All-Star Alex Wong (Blackbaud Financial Edge NXT®)
- 6 Ask an All-Star (Christine Robertson)
- 21 Ask an Expert (Anthony Gallo)
- Blackbaud Francophone Group
- 22 Ask an Expert (David Springer)
- 4 Raiser's Edge NXT PowerUp Challenge #1 (Query)
- 6 Ask an All-Star Sunshine Reinken Watson and Carlene Johnson
- 4 Raiser's Edge NXT PowerUp Challenge: Events
- 14 Ask an All-Star (Elizabeth Johnson)
- 7 Ask an Expert (Stephen Churchill)
- 2025 ARCHIVED FORUM POSTS
- 322 ARCHIVED | Financial Edge® Tips and Tricks
- 164 ARCHIVED | Raiser's Edge® Blog
- 300 ARCHIVED | Raiser's Edge® Blog
- 441 ARCHIVED | Blackbaud Altru® Tips and Tricks
- 66 ARCHIVED | Blackbaud NetCommunity™ Blog
- 211 ARCHIVED | Blackbaud Target Analytics® Tips and Tricks
- 47 Blackbaud CRM Higher Ed Product Advisory Group (HE PAG)
- Luminate CRM DC Users Group
- 225 ARCHIVED | Blackbaud eTapestry® Tips and Tricks
- 1 Blackbaud eTapestry® Know How Blog
- 19 Blackbaud CRM Product Advisory Group (BBCRM PAG)
- 1 Blackbaud K-12 Education Solutions™ Blog
- 280 ARCHIVED | Mixed Community Announcements
- 3 ARCHIVED | Blackbaud Corporations™ & Blackbaud Foundations™ Hosting Status
- 1 npEngage
- 24 ARCHIVED | K-12 Announcements
- 15 ARCHIVED | FIMS Host*Net Hosting Status
- 23 ARCHIVED | Blackbaud Outcomes & Online Applications (IGAM) Hosting Status
- 22 ARCHIVED | Blackbaud DonorCentral Hosting Status
- 14 ARCHIVED | Blackbaud Grantmaking™ UK Hosting Status
- 117 ARCHIVED | Blackbaud CRM™ and Blackbaud Internet Solutions™ Announcements
- 50 Blackbaud NetCommunity™ Blog
- 169 ARCHIVED | Blackbaud Grantmaking™ Tips and Tricks
- Advocacy DC Users Group
- 718 Community News
- Blackbaud Altru® Hosting Status
- 104 ARCHIVED | Member Spotlight
- 145 ARCHIVED | Hosting Blog
- 149 JustGiving® from Blackbaud® Blog
- 97 ARCHIVED | bbcon® Blogs
- 19 ARCHIVED | Blackbaud Luminate CRM™ Announcements
- 161 Luminate Advocacy News
- 187 Organizational Best Practices Blog
- 67 everydayhero Blog
- 52 Blackbaud SKY® Reporting Announcements
- 17 ARCHIVED | Blackbaud SKY® Reporting for K-12 Announcements
- 3 Luminate Online Product Advisory Group (LO PAG)
- 81 ARCHIVED | JustGiving® from Blackbaud® Tips and Tricks
- 1 ARCHIVED | K-12 Conference Blog
- Blackbaud Church Management™ Announcements
- ARCHIVED | Blackbaud Award Management™ and Blackbaud Stewardship Management™ Announcements
- 1 Blackbaud Peer-to-Peer Fundraising™, Powered by JustGiving® Blogs
- 39 Tips, Tricks, and Timesavers!
- 56 Blackbaud Church Management™ Resources
- 154 Blackbaud Church Management™ Announcements
- 1 ARCHIVED | Blackbaud Church Management™ Tips and Tricks
- 11 ARCHIVED | Blackbaud Higher Education Solutions™ Announcements
- 7 ARCHIVED | Blackbaud Guided Fundraising™ Blog
- 2 Blackbaud Fundraiser Performance Management™ Blog
- 9 Foundations Events and Content
- 14 ARCHIVED | Blog Posts
- 2 ARCHIVED | Blackbaud FIMS™ Announcement and Tips
- 59 Blackbaud Partner Announcements
- 10 ARCHIVED | Blackbaud Impact Edge™ EAP Blogs
- 1 Community Help Blogs
- Diocesan Blackbaud Raiser’s Edge NXT® Users' Group
- Blackbaud Consultant’s Community
- Blackbaud Francophone Group
- 1 BLOG ARCHIVE CATEGORY
- Blackbaud Community™ Discussions
- 8.3K Blackbaud Luminate Online® & Blackbaud TeamRaiser® Discussions
- 5.7K Jobs Board