Solved

Fast Queries

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

776 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