Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Fast Queries

Posted on 1998-08-07
3
Medium Priority
?
263 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 80 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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 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…

972 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