ACC: Tips for Optimizing Queries on Attached SQL TablesID: Q99321
|
Advanced: Requires expert coding, interoperability, and multiuser skills.
Special considerations must be made for performance optimization of
queries built on attached SQL database tables. An SQL database, for
this article, is defined as any client/server database that supports
some level of ANSI SQL as an intrinsic part of the database's
programming language. Optimal query strategy for these queries is to
ensure that all query operations are performed on the server. This
article outlines tips on how to ensure that queries against attached
SQL database tables are performed on the server.
This article assumes a basic understanding of client/server computing
environments and architectures.
The key to improving query performance on attached SQL database tables
is to ensure that no data is filtered on the client. Filtering data on
the client increases network traffic and does not allow for leveraging
of advanced server hardware, essentially turning a client/server
system into a file server system. To this end, keeping the query
evaluation on the server reduces overhead and keeps an application
running as fast as possible.
Generic query optimization techniques should not be ignored when you are
using attached SQL database tables. "WHERE clause" restrictions, such as
equality or range comparisons, and sorting should still be performed on
indexed fields. For more information on query optimization, call Microsoft
Sales Information Center at 800 426-9400 to order a "white paper" on SQL
Server optimization. Other SQL database vendors may provide the same
information for their customers.
Use care when implementing intrinsic or user defined functions (UDFs)
in query fields or when using criteria that are not supported on the
server. Generally, SQL databases have functionality that corresponds
to most standard Microsoft Access functions, but each server will be
different.
Many intrinsic Microsoft Access functions have direct back-end
correspondents. Microsoft Access asks the ODBC driver about intrinsic
function support and performs the appropriate mappings.
You can use UDFs and Microsoft Access intrinsic functions without server
equivalents when they are accompanied by server-capable restrictions
that restrict the data. For example, the following query
Query1a: SELECT * FROM MillionRowTable WHERE Funk1(col1) = 10
Query1b: SELECT * FROM MillionRowTable WHERE Funk1(col1) = 10
AND LastName BETWEEN 'g' AND 'h'
Query2a: SELECT * FROM MyTable WHERE Format(col1, ...) = 10
Query2b: SELECT Format(col1,...) FROM MyTable WHERE col2 = 10
Query3a: SELECT DISTINCT col1 FROM MyTable
Query3b: SELECT DISTINCT Format(col1,...) FROM MyTable
Query4a: SELECT Sum(col1) FROM MyTable
Query4b: SELECT StdDev(col1) FROM MyTable
WHERE col1 > 1000
WHERE col1 between 1000 and 1000000000
Keywords : kbusage OdbcOthr
Version : 1.0 1.1 2.0 7.0 97
Platform : WINDOWS
Issue type : kbinfo
Last Reviewed: March 23, 1999