@Db Functions Performance Tips

@Db Functions Performance Tips

@DbLookups and @DbColumns are incredibly useful, but they can be quite a
performance drag on a large application. Use these rules of thumb to minimize
the cost of your @Db functions, without reducing functionality.


Minimize the number of @Db functions in any form.
Have @Db functions refer to views on the same database where possible. Keep
your data in one place if not too big.
If there is a group of fields which are returned via @DbLookup, use one
@DbLookup to return a BigField (which contains a list of the contents of all of
those fields), and then parse that field out in your document using @Word.
Look up a column number, not a field name or column name.
Use the "NoCache" option whenever it won't affect logic of the lookup. This
option has no effect on the HTTP (web) server.
For documents which are often just read (as opposed to almost always being
edited), you should use @IsDocBeingLoaded as part of the formula, or put the
@Db functions into buttons, not into fields.
Use column number instead of field name for DbLookup and DbColumn calls.
Looking up by FieldName requires the lookup to go into the document and find
the field. Column number allows the lookup to pull the value directly off the
view index, which is much faster.
When trapping for lookup errors, load the lookup result into a temporary
variable to check for

    Requires Free Membership to View

    Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.

    By submitting your registration information to SearchDomino.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchDomino.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

an error, rather than performing the lookup twice. For
example:

_ret := @DbLookup("":"NoCache"; ""; "my view"; ProjectName; 2);
@If(@isError(ret); "Error: Could not find Project " +ProjectName+ ". Please
create one."; _ret)

This was first published in November 2000

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.