Solved

Fast Queries

Posted on 1998-08-07
1
134 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…

860 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