Solved

Fast Queries

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

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 …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

708 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