473,406 Members | 2,336 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,406 software developers and data experts.

DAO efficiency question

Hello,

Assuming that I am only interested in one record within a table, which
is more efficient (Account Number is unique)?:

1.
Set D = CurrentDb
Set rsCust = D.OpenRecordset("SELECT [Group Number] FROM Customers
WHERE [Account Number] = '" & [Account Number] & "'", DB_OPEN_DYNASET)
2.
Set D = CurrentDb
Set rsCust = D.OpenRecordset("Customers", DB_OPEN_DYNASET)

Criteria = "[Account Number] = '" & [Account Number] & "'"
rsCust.FindFirst Criteria

Thank you.
Nov 12 '05 #1
1 1437

Aaron,

On 10 Dec 2003 08:21:55 -0800, ha***********@hotmail.com (Aaron
Hartley) wrote in comp.databases.ms-access:
Assuming that I am only interested in one record within a table, which
is more efficient (Account Number is unique)?:

1.
Set D = CurrentDb
Set rsCust = D.OpenRecordset("SELECT [Group Number] FROM Customers
WHERE [Account Number] = '" & [Account Number] & "'", DB_OPEN_DYNASET)
2.
Set D = CurrentDb
Set rsCust = D.OpenRecordset("Customers", DB_OPEN_DYNASET)

Criteria = "[Account Number] = '" & [Account Number] & "'"
rsCust.FindFirst Criteria


You haven't mentioned whether the tables are stored in the same file
as the one containing this code, or in a separate backend, or what
type of storage is used for the tables.

In general, (1) is the recommend approach because it is more flexible,
and requires fewer locks. There may well be simple scenarios where
(2) is faster, but (1) is better in most cases.

Briefly, this is because (1) allows for the returned recordset to only
contain the desired record, while (2) returns a recordset (editable,
in this case) of all records in the underlying table, resulting in a
greater number of locks. Also, if the backend were in some other
rdbms (like SQL Server) and the tables were linked to the Access
front-end, (1) allows for server side processing, while (2) does not,
resulting in a lot more network i/o for (2). You may not currently
use sql server on the backend, but (1) makes any such placement issues
irrelevant (in this particular sense) requiring no code change here
for improved performance.

In general, you always want to design any app so that the fewest
possible records are returned for the task at hand, and that minimal
locks are placed on those records sufficient for current needs. If
you need to edit one record, getting an editable recordset of a wide
range of records is a bad idea.
Peter Miller
__________________________________________________ __________
PK Solutions -- Data Recovery for Microsoft Access/Jet/SQL
Free quotes, Guaranteed lowest prices and best results
www.pksolutions.com 1.866.FILE.FIX 1.760.476.9051
Nov 12 '05 #2

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

Similar topics

2
by: Sara | last post by:
Hi - I've been reading the posts for a solution to my query, and realize that I should ask an "approch" question as well. We receive our production data from a third party, so my uers import...
31
by: mark | last post by:
Hello- i am trying to make the function addbitwise more efficient. the code below takes an array of binary numbers (of size 5) and performs bitwise addition. it looks ugly and it is not elegant...
92
by: Dave Rudolf | last post by:
Hi all, Normally, I would trust that the ANSI libraries are written to be as efficient as possible, but I have an application in which the majority of the run time is calling the acos(...)...
1
by: Tomás | last post by:
dynamic_cast can be used to obtain a pointer or to obtain a reference. If the pointer form fails, then you're left with a null pointer. If the reference form fails, then an exception is thrown....
19
by: Frederick Gotham | last post by:
Commonly, people may ask a question along the lines of, "Which code snippet is more efficient?". If the code is anything other than assembler (e.g. C or C++), then there's no precise answer...
9
by: burningsunorama | last post by:
Hi guys! This is maybe a too 'academic problem', but I would like to hear your opinions, something like pros and cons for each approach.... ... Recently we've had at work a little talk about the...
19
by: vamshi | last post by:
Hi all, This is a question about the efficiency of the code. a :- int i; for( i = 0; i < 20; i++ ) printf("%d",i); b:- int i = 10;
9
by: OldBirdman | last post by:
Efficiency I've never stumbled on any discussion of efficiency of various methods of coding, although I have found posts on various forums where individuals were concerned with efficiency. I'm...
9
by: anon.asdf | last post by:
In terms of efficieny: Is it better to use multiple putchar()'s after one another as one gets to new char's OR is it better to collect the characters to a char-array first, and then use...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.