Solved

Fast Queries

Posted on 1998-08-07
3
243 Views
Last Modified: 2012-05-04
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
3 Comments
 
LVL 14

Expert Comment

by:waty
ID: 1468236
I think you have forgot to set your query 'rdAsyncEnable'

Set rs = qd.OpenResultset(rdOpenKeyset, rdOpenForwardOnly, , rdAsyncEnable)

0
 
LVL 2

Expert Comment

by:percosolator
ID: 1468237
show us a couple of sample queries. Your problem more than is more than likely going to lie within the query.

RDO is faster than both DAO and data-bound objects.  If you have extensive outter joins, then you are probably going to see some performance problems.

Other pertinent information:  table structures, number of records, etc...
0
 

Accepted Solution

by:
newlook earned 40 total points
ID: 1468238
Properly index your SQL and ensure that your query uses that
index (try running direct to the database outside vb)
understand your databases optimizer - you didnt specify which
database you were using, but for example oracle uses a complex
optimizer which can be cost or rule based - understanding how
it processes your query and coding your sql to take advantage
will significantly speed it up.
Check your joins (if any) - make sure you are not getting a
cartesian product

0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now