Re: .Execute vs. .RunSQL - Speed vs. Size
From: Marshall Barton (marshbarton_at_wowway.com)
Date: 03/01/05
- Next message: Bill: "Combo Box Selection"
- Previous message: James: "Re: Setting the Use Specific Printer"
- In reply to: Randy Fritz: ".Execute vs. .RunSQL - Speed vs. Size"
- Next in thread: Randy Fritz: "Re: .Execute vs. .RunSQL - Speed vs. Size"
- Reply: Randy Fritz: "Re: .Execute vs. .RunSQL - Speed vs. Size"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 28 Feb 2005 21:16:20 -0600
Randy Fritz wrote:
> I have a question - I am trying to speed up my Database and would like
>to know which is faster - Dim a database and then use the db.execute method
>or just use the docmd.RunSQL Method
I think db.Execute might be marginally faster, but probably
not enough to notice.
It is a good idea to Set db = CurrentDb() because you can
then use the RecordsAffected property to find out how many
records were added, deleted or modified. Certainly it's
somewhat faster to use the Set db ... if you are going to
Execute a sequence of action queries.
Note that Execute requires you to resolve any query
parameters in your code before executing the query. OTOH,
when Access processes the RunSQL method it will take care of
the parameters for you.
All this is mostly irrelevant if you really need to improve
performance. As far as query performance is concerned you
can gain orders of magnitude better improvement by making
sure you have all the Join, Where and Order By fields
indexed (but don't duplicate the automatic index on a
foreign key used in a Relationship). Another important
thing is to remove any **unnecessary** keywords such as
DISTINCT, etc.
-- Marsh MVP [MS Access]
- Next message: Bill: "Combo Box Selection"
- Previous message: James: "Re: Setting the Use Specific Printer"
- In reply to: Randy Fritz: ".Execute vs. .RunSQL - Speed vs. Size"
- Next in thread: Randy Fritz: "Re: .Execute vs. .RunSQL - Speed vs. Size"
- Reply: Randy Fritz: "Re: .Execute vs. .RunSQL - Speed vs. Size"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|