Solved

Fast Queries

Posted on 1998-08-07
3
247 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

813 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

13 Experts available now in Live!

Get 1:1 Help Now