Solved

Fast Queries

Posted on 1998-08-07
1
135 Views
Last Modified: 2010-04-30
I have written a program using RDO objects that use odbc etc to access a database. I find however that the queries are very slow. The following is a sample of the type of code im using:
Dim qd as rdoQuery
Set qd = cn.CreateQuery("qd",SQL)
qd.MaxRows = nRowCount
Set rs = qd.OpenResultset(rdOpenKeyset)
while rs.stillexecuting
   DoEvents
wend

Can anyone give me a few tips on how to speed up my queries?
0
Comment
Question by:Coates
1 Comment
 
LVL 9

Accepted Solution

by:
cymbolic earned 40 total points
ID: 1468239
Some options for you:

Consider the use of the Client Batch cursor library (rdUseCLientBatch).

Use a stored procedure rather than in line SQL.

Use a Use a forward only, readonly cursor, and update via a stored procedure or .execute methods.

If you have BLOB columns involved,  make sure you are not using the rdFetchLongColumns property to fetch them with other columns.  Get 'em later only if you need 'em.

Check your client machines.  Are there protocols installed in the protocol stack that are not being used?  This will slow everything down as Windows gives them time to no result.

Are you performing major amounts of updates over time?  Issue periodic Update Statistics to SQL Server to rebuild query paths.

Check your underlying tables with DBCC.

Consider using simpler, multipass queries instead of a major joined query (very complex SQL).  Your own methodology and process generally outguesses the SQL Query processor.

Using joined queries from multiple tables?  Create views on SQL Server, then execute your queries against the views.

FInally, get and read "Hitchiker's Guide to Visual Basic & SQL Server" by W. R. Vaughn.  
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question