"macroapa" <(E-Mail Removed)> wrote in message
news:6b0b2bef-632f-4521-b7e0-(E-Mail Removed)...
> Hi, I have a select query that takes about 5 seconds to run. If I
> take the same query and turn it into a make table query, it takes
> about 15 mins to run. I'm almost at the stage of running a SELECT
> query and copying the data and pasting into the table. Is there
> anything I can do to increase performance of the make table query?
>
> =============================================================================
> SELECT sql
>
> SELECT tblaaTRTvsExtTRT.workitemid, tblaaTRTvsExtTRT.stepname,
> tblaaTRTvsExtTRT.workitemstepid, tblaaTRTvsExtTRT.Available,
> tblaaTRTvsExtTRT.Worked, tblaaTRTvsExtTRT.StepStarted,
> tblaaTRTvsExtTRT.TouchStopped, qryTrueStepStop.TrueStepStop,
> tblaaTRTvsExtTRT.workitemdate, tblaaTRTvsExtTRT.status_desc,
> tblaaTRTvsExtTRT.wistopdate, workdaysdiff([available],[worked]) AS
> aaTRT, workdaysdiff([stepstarted],[truestepstop]) AS wholeTRT
> FROM tblaaTRTvsExtTRT INNER JOIN qryTrueStepStop ON
> tblaaTRTvsExtTRT.workitemstepid = qryTrueStepStop.workitemstepid;
>
>
> =============================================================================
> Make table sql
>
> SELECT tblaaTRTvsExtTRT.workitemid, tblaaTRTvsExtTRT.stepname,
> tblaxTRTvsExtTRT.workitemstepid, tblaaTRTvsExtTRT.Available,
> tblaaTRTvsExtTRT.Worked, tblaaTRTvsExtTRT.StepStarted,
> tblaaTRTvsExtTRT.TouchStopped, qryTrueStepStop.TrueStepStop,
> tblaaTRTvsExtTRT.workitemdate, tblaaTRTvsExtTRT.status_desc,
> tblaaTRTvsExtTRT.wistopdate, workdaysdiff([available],[worked]) AS
> aaTRT, workdaysdiff([stepstarted],[truestepstop]) AS wholeTRT INTO
> tblaaTRTandWholeTRT
> FROM tblaaTRTvsExtTRT INNER JOIN qryTrueStepStop ON
> tblaaTRTvsExtTRT.workitemstepid = qryTrueStepStop.workitemstepid;
How many records are you dealing with?
I suspect that the SELECT query takes longer to run than you think; or
rather, that it takes longer to run and return all records *including the
calculated values aaTRT and wholeTRT* than you think. Access optimizes
queries for display by only calling VBA functions when the record is
accessed. You may be able to see, as you page through the query results,
that there is a slight delay before the values for those calculated fields
are displayed.
Also, if you open a SELECT query as a datasheet, it returns the first page
of records as quickly as possible, while continuing to retrieve records
behind the scenes. So the query appears to complete quickly, but for
long-running queries that is an illusion.
I could be wrong about this, and it could be that there is really such an
enormous disparity between the select query and the make-table query, but I
don't see why. You might check it by opening a recordset on the query and
looping through the records, using Debug.Print to print the calculated
fields in each record to the Immediate window. My guess is that it will
take a lot longer than 5 seconds.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)