Home > Archive > MS SQL Server > July 2005 > Is there a better (faster) way?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Is there a better (faster) way?
Eric Stewart

2005-07-18, 8:23 pm

I am running this query on MS SQL 2000 that is deleting records on an AS400
table. Extremely slow. Is there a different way I should/could do this?

\

Background - Data comes into COMMON. I read the data into #LoadSwipes,
process the data, and then want to delete the processed records from COMMON.

delete KRONOS.RSIGL.TIMECUSTOM.COMMON
from #LoadSwipes ls
inner join KRONOS.RSIGL.TIMECUSTOM.COMMON k
on ls.Area = k.Area and
ls.TimeSt = k.TimeSt and
ls.EmpNum = k.EmpNum and
ls.Clock = k.Clock and
ls.EmpNu9 = k.EmpNu9 and
ls.ActIn = k.ActIn


Thanks
Eric


MGeles

2005-07-18, 8:23 pm

Hi Eric,

This might not apply to you situation, but one thing that you may consider
is copying the record that you want to keep into a seperate temp table, then
truncate the original table, and finally copy the records from the temp table
back to the original.

This would be useful if the number of records that you want to keep is
dramatically less than the number of records that you want to delete.
--
MG


"Eric Stewart" wrote:

> I am running this query on MS SQL 2000 that is deleting records on an AS400
> table. Extremely slow. Is there a different way I should/could do this?
>
> \
>
> Background - Data comes into COMMON. I read the data into #LoadSwipes,
> process the data, and then want to delete the processed records from COMMON.
>
> delete KRONOS.RSIGL.TIMECUSTOM.COMMON
> from #LoadSwipes ls
> inner join KRONOS.RSIGL.TIMECUSTOM.COMMON k
> on ls.Area = k.Area and
> ls.TimeSt = k.TimeSt and
> ls.EmpNum = k.EmpNum and
> ls.Clock = k.Clock and
> ls.EmpNu9 = k.EmpNu9 and
> ls.ActIn = k.ActIn
>
>
> Thanks
> Eric
>
>
>

Eric Stewart

2005-07-18, 8:23 pm

Thanks for the suggestion MG. However, I don't think that applies here. The
table on the AS400 is continually receiving data. I read data from that
table into a SQL temp table and process the records in the temp table.
Meantime, more records are flowing into the AS400 table. The temp table
serves as my means of knowing which records can be deleted from the AS400
table.

Eric

"MGeles" <michael.geles@thomson.com> wrote in message
news:34A0DE2D-FE23-4484-918C- F32E52A09DA6@microso
ft.com...
> Hi Eric,
>
> This might not apply to you situation, but one thing that you may consider
> is copying the record that you want to keep into a seperate temp table,

then
> truncate the original table, and finally copy the records from the temp

table[color=darkred]

> back to the original.
>
> This would be useful if the number of records that you want to keep is
> dramatically less than the number of records that you want to delete.
> --
> MG
>
>
> "Eric Stewart" wrote:
>
AS400[color=darkred]

COMMON.[color=darkred]


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com