• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 23. Optimizing Your Application > Designing Queries to Optimize Perform...

Designing Queries to Optimize Performance

Optimizing your queries requires a great deal of practice and experimentation. Some queries involving a one-to-many relationship run more efficiently if you place the criteria on the one side of the relationship, for example. Others run more efficiently if you place the criteria on the many side. Understanding some basics can go a long way toward improving the performance of your queries and your application as a whole:

  • Include as few columns in the result set as possible.

  • Try to reduce the number of complex expressions contained in the query. Although including a complex expression in a query eliminates the need to build the expression into each form and report, the performance benefits gained sometimes are worth the trouble.

  • Use the Between operator instead of greater than (>) and less than (<).

  • Use Count(*) rather than Count([column]).

  • Group Totals queries by the field that is in the same table you are totaling. In other words, if you are totaling cost multiplied by price for each order in the Order Detail table, group by the order ID in the Order Detail table, not the order ID in the Orders table.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint