Article View: borland.public.interbase.opensource
Article #360Re: Really Slow Delete on an System
From: Jarek Bialik
Date: Mon, 08 Nov 2004 21:52
Date: Mon, 08 Nov 2004 21:52
51 lines
2833 bytes
2833 bytes
Thanks Bill , I'll try the S.P. approach, then lesson here I guess is use proper indexing and referencing with cascading deletes in future database design! Jarek Bialik Britec Computer Consulting "Bill Todd" <no@no.com> wrote in message news:418fdbc7@newsgroups.borland.com... > The problem is that the subquery has to scan the entire table > sequentially without using an index and the delete has to scan the 3500 > rows returned by the subquery for each row in the table you are > deleting from. > > One thing that will help is to use a stored procedure with a FOR SELECT > to replace the subquery and the DELETE in the DO clause of the FOR > SELECT. Make sure WipNo is indexed. > > For even better performance convert the inqDate column to type DATE or > add a shadow column that stores the date as type DATE and update the > shadow value automatically with a trigger. > > -- > Bill (TeamB) > TeamB cannot answer questions received via email > > Jarek Bialik wrote: > >> Hi Bill, thanks for your response, >> >> Unfortunately that "date" column is actually stored as Varchar(10), >> so it needs a type cast. The Select will return about ~3500 rows. >> >> So does the subquery execute for every row in the delete query? >> Shouldnt the select sub query execute only once? >> >> Thanks >> Jarek Bialik >> Britec Computer Consultanting >> "Bill Todd" <no@no.com> wrote in message >> news:418c1939$1@newsgroups.borland.com... >> > Why do you need to cast the value from the inqDate column? What is >> > its data type? >> > >> > How many rows does the SELECT return? >> > >> > -- >> > Bill (TeamB) >> > TeamB cannot answer questions received via email
Technical Details
Message-ID:
<418feaa2@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<418c133c$1@newsgroups.borland.com> <418c1939$1@newsgroups.borland.com> <418fa654@newsgroups.borland.com> <418fdbc7@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 106772,edefe87e3c53cf5d X-Google-Attributes: gid106772,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Jarek Bialik" <jbialik@telusplanet.net> Newsgroups: borland.public.interbase.opensource References: <418c133c$1@newsgroups.borland.com> <418c1939$1@newsgroups.borland.com> <418fa654@newsgroups.borland.com> <418fdbc7@newsgroups.borland.com> Subject: Re: Really Slow Delete on an System Date: Mon, 8 Nov 2004 14:52:35 -0700 Lines: 53 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 69.36.97.40 Message-ID: <418feaa2@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1099950754 69.36.97.40 (8 Nov 2004 13:52:34 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail