Solved

SQL & VB question

Posted on 1998-07-05
4
183 Views
Last Modified: 2010-03-19
what is the most efficient way to open a recordset. Using jet I mad the following call:
stsql = "Select * from Catalog where descript like '*hello*' AND dealer < 50 AND stock > 1 AND DESCRIPT2 LIKE '*cd*'"
SET RECSET = DBS.OPENRECORDSET(STSQL)


Using RDO, I coded as follows After changing the * to %
set rs = cn.openresultset(stsql)
It does not seem to be terribly faster than JET, on Access. The table has 50,000 records, and is approx 8mb in size. The problem is that it is a network app, and lot's of differnt searches are done. Any suggestions, and/or comments would be appreciated. Thanks
0
Comment
Question by:redbaron082997
4 Comments
 
LVL 4

Expert Comment

by:vvk
Comment Utility
What indexes you have on this table?
Try to use OLE interface to SQL server as described in SQL Books on-line or sqlole.hlp file.
0
 
LVL 9

Accepted Solution

by:
cymbolic earned 50 total points
Comment Utility
It's not going to be terribly fast in any of the access methods, because from the looks of your query, a table scan is being used .  Anytime you use something like the "Like" operatoer and especially with masking, you are asking the server to look at all records to see which qualify.  There is no question that in continued use under all types of queries, an ODBC interface to SQL Server using RDO will be better and faster than using the Jet/DAO methods.

However, some queries are not very good under either methods, because they present no opportunity to the server of optimizing lookups using previously defined indexes.
0
 
LVL 1

Author Comment

by:redbaron082997
Comment Utility
would using a stored procedure help?  All values being searched are indexed.
0
 

Expert Comment

by:rferly
Comment Utility
I agree with the first anwer but if it helps I would add that you can use a like, providing you dont use a like "%something"

With a like "something%" the right index can be used by the optimiser
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

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