472,973 Members | 2,405 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Speed improvements for cyclic data processing and transformation tasks

Hi everyone,

I am trying to refine some ADO code that is used to extract data from
excel spreadsheets and do a simple ETL type process to place the data
into a table. The code works fine and is seemingly reliable enough. It
is also as slow as <insert metaphor>.

Basically the process is taking the excel sheet and reading it into a
disconnected recordset. Easy done. The next step is done with a
combination of ADO and DAO code. The incoming rows are checked one at
a time against the existing import data table - new rows are added as
needed and existing rows are updated as needed. This is achieved by
using two loops, one nested in the other.

Before I go and make this more 'efficient' I thought that I would ask
peoples opinions on speeding this up. I was thinking of using filters
to reduce the size of the loops, but maybe there is even a better way.

It was suggested that I load the ADO recordset into an array for
processing, but I really cant see any advantage here for that
approach.

Any suggestions would be greatly appreciated before I re-vamp this
piece of code. Is there a speed difference between find and filter
methods for example....

Thanks in advance

The Frog

Sep 28 '07 #1
3 2092
On Fri, 28 Sep 2007 12:27:09 -0000, The Frog
<Mr************@googlemail.comwrote:

I would rather look at a completely different method. For example
creating the Excel file as an attached table, and running an Append
query to copy the data to the destination table.

-Tom.

>Hi everyone,

I am trying to refine some ADO code that is used to extract data from
excel spreadsheets and do a simple ETL type process to place the data
into a table. The code works fine and is seemingly reliable enough. It
is also as slow as <insert metaphor>.

Basically the process is taking the excel sheet and reading it into a
disconnected recordset. Easy done. The next step is done with a
combination of ADO and DAO code. The incoming rows are checked one at
a time against the existing import data table - new rows are added as
needed and existing rows are updated as needed. This is achieved by
using two loops, one nested in the other.

Before I go and make this more 'efficient' I thought that I would ask
peoples opinions on speeding this up. I was thinking of using filters
to reduce the size of the loops, but maybe there is even a better way.

It was suggested that I load the ADO recordset into an array for
processing, but I really cant see any advantage here for that
approach.

Any suggestions would be greatly appreciated before I re-vamp this
piece of code. Is there a speed difference between find and filter
methods for example....

Thanks in advance

The Frog
Sep 28 '07 #2
Hi.
The incoming rows are checked one at
a time against the existing import data table - new rows are added as
needed and existing rows are updated as needed. This is achieved by
using two loops, one nested in the other.
No wonder it's so slow. You're cursoring through two datasets. It's much
faster to import the data into a temporary table, then use a single UPDATE
query that includes an OUTER JOIN to join the temp table to the table where
you want the data to be stored. The UPDATE query will update any existing
rows and add new rows as needed.

Please see the following Web page for former Access MVP Joe Fallon's
instructions on how to build the UPDATE query:

http://groups.google.com/group/micro...162298434d4396
It was suggested that I load the ADO recordset into an array for
processing, but I really cant see any advantage here for that
approach.
Let the database engine do the work for you, and do it far quicker, too.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.
Sep 28 '07 #3
Hi Fellas,

Thanks for the suggestion on the importing routine, it works a treat.
I still have an issue with the exporting of the data though. The
'export' is actually done in Excel (as an add-in). The worksheet that
is processed depends on the data in this database to do its work.
Effectively, for each row on the sheet I have to hunt down the
appropriate record in the database. I am still curious to know if
there is a difference between the speed of operation of the filter
method and the find method. I can really on do the second part in
Excel and not in Access, so I am using ADO code to keep a disconnected
recordset of the 'Product' table that the macro relies on.

The second part certainly works okay, its just not that quick. I am
currently using the filter method but am open to any suggestions.

Cheers

The Frog

ps: the append method is working in a fraction of the time of the
previous - many thanks indeed.

Oct 1 '07 #4

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

Similar topics

7
by: Catalin | last post by:
How can I make executables with python? I found some utilities that claim they can do something like that like Installer and py2exe but they actualy pack the code in a huge arhive! This solves the...
6
by: Ramon M. Felciano | last post by:
Helo all -- I'm trying to gain a deeper understand for what type of semi-declarative programming can be done through XML and XPath/XSLT. I'm looking at graph processing problems as a testbed for...
7
by: Brian Sabolik | last post by:
I'm not sure if I've broken any Object Oriented rules or not, but ... I have projects in 2 different solutions that need to use each other's methods. Therefore I may have an "update" method in...
1
by: Benjamin Lefevre | last post by:
I am currently developping a web crawler, mainly crawling mobile page (wml, mobile xhtml) but not only (also html/xml/...), and I ask myself which speed I can reach. This crawler is developped in...
25
by: Stijn Oude Brunink | last post by:
Hello, I have the following trade off to make: A base class with 2 virtual functions would be realy helpfull for the problem I'm working on. Still though the functions that my program will use...
2
by: hipo | last post by:
Hi: I'm trying to read data from Navision 2.60 ERP with own database to a SQL Server 2000 database via ODBC. All is working except just one thing, how to filter data with a date field. I have...
12
by: PD | last post by:
I am currently making a dating website. I want to have some information on how to structure the database and the php files so that I can achieve speed and efficiency. Can some one please give...
19
by: vunet.us | last post by:
Hello, My AJAX application paints data into about 500 cells with unique ID every 10 seconds. I am using document.getElementById() to find the right cell. However, I have noticed that...
18
by: maxhugen | last post by:
I have an Access app (split into FE and BE) running for some years, that is now also being used in a second office, connected by a WAN. This office has network problems, as it's over-utilized (97%...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.