Solved

Fast Queries

Posted on 1998-08-07
3
251 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

739 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