473,387 Members | 1,295 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ADO query question - which is faster?

When I'm opening a recordset for add new, is it faster to put a
limiting clause on it?

i.e. does

"Select [Fields] from [Table] Where Keyfield = " & value & "

return a recordset faster than

"Select [Fields] from [Table]"
given that I know that the value I query for will not be found?

Nov 13 '05 #1
3 2042
"mathilda" <sm***********@yahoo.com> wrote
When I'm opening a recordset for add new, is it faster to put a
limiting clause on it?

i.e. does

"Select [Fields] from [Table] Where Keyfield = " & value & "

return a recordset faster than

"Select [Fields] from [Table]"
given that I know that the value I query for will not be found?


B. But it would be faster still to just use:

rs.Open "table", cnxn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
rs.AddNew

Faster still:

cnxn.Execute "INSERT INTO table ..."
Darryl Kerkeslager

Nov 13 '05 #2
Thanks!

But a follow up question if I could. I haven't used adOpenKeyset
before. When I will be writing to a table I have always been using
adOpenDynamic because I was under the impression that Keyset did not
create a writeable cursor. What are the advantages of Keyset?

Nov 13 '05 #3
"mathilda" <sm***********@yahoo.com> wrote
Thanks!

But a follow up question if I could. I haven't used adOpenKeyset
before. When I will be writing to a table I have always been using
adOpenDynamic because I was under the impression that Keyset did not
create a writeable cursor. What are the advantages of Keyset?


In a way, none. When you use a server-side cursor in ADO (nearly always),
and request a Dynamic cursor, ADO actually creates a Keyset cursor, except
in the case when you request a Dynamic ReadOnly cursor (which I see no
reason to do), when you get a Static type.

So there is probably no performance difference; I've just always used Keyset
on the assumption that I should "ask for what I'm going to get anyways".

DISCLAIMER: Does not apply to confrontational social situations.
Darryl KerkeslAger
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: David | last post by:
Consider this SQL Query: ----------------------------------------------------------------- SELECT c.CASE_NBR, DATEDIFF(d, c.CREATE_DT, GETDATE()) AS Age, c.AFFD_RCVD, c.PRV_CRD_ISS, x.RegE,...
9
by: netpurpose | last post by:
I need to extract data from this table to find the lowest prices of each product as of today. The product will be listed/grouped by the name only, discarding the product code - I use...
4
by: sci | last post by:
Could someone help me by answering the questions below? What's a cursor? What's difference between Query and View? Is a RecordSet just part of a table? Can it be part of a query of view? If...
4
by: Orion | last post by:
Hi, This is kind of last minute, I have a day and a half left to figure this out. I'm working on a project using ms-sqlserver. We are creating a ticket sales system, as part of the system, I...
2
by: ruben | last post by:
Hi: I must have missed something, but how is it possible that a join on tables A and B is faster (a lot faster) than a query to one of the tables with the same conditions? The problem seems...
11
by: 73blazer | last post by:
We are migrating a customer from Version 7.1 FP3, to Version 8.2 (8.1 FP8). For the most part, things are faster, but there is one query that is much much slower, and it is a query that is used all...
4
by: cefrancke | last post by:
Are there any ways to speed up a Cumulative sum in a query or perhaps another faster way to have a cumulative sum column (call a vba function?). For example, I want to sum up all values under...
24
by: clare at snyder.on.ca | last post by:
I have a SQL query I need to design to select name and email addresses for policies that are due and not renewed in a given time period. The problem is, the database keeps the information for every...
10
by: Raj | last post by:
I have an MDC index on Big_A.Dt column. The following query always goes for a table scan. SELECT Key, Cd, Dt, SUM(Big_A ) FROM ( SELECT Big_A.Key , small_3.Cd,
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.