🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.opensource
Article #347

Re: Really Slow Delete on an System

#347
From: Dan Palley
Date: Sat, 06 Nov 2004 00:41
39 lines
2188 bytes
"Jarek Bialik" <jbialik@telusplanet.net> wrote in message
news:418c133c$1@newsgroups.borland.com...
> Hi all
>  I implemented a client solution running om IB 6 opensource, this was
years
>  ago and the database / table structure is defintely not optimized. In
terms
> of
>  indices and referential constraints and cascading deletes, I know all of
> this
>  stuff now but like I said this was years ago. Anyways I have a query of
the
> form
> Delete From PaymentsWip Where WipNo in
>
> (select WipNo From InternalInvmaster Where (Cast(inqDate as Date) <=
> '12/31/2001'))
>
>  and its really slow, and I need to have about 10 of these run on separate
> tables,
>  I tried to backup and restore and sweep and then ran the query, but that
> only shaved off
>  4min on a 20 min query,
>
> the question , should I create an Index on the inqDate fields, and is the
> "in" operator
> in the SQL the issue, can I re-wite the query? Also I was running this
right
> from the IBConsole.
>
> any suggestions would really be helpful as I need to dump a bunch of data
> monday morning
> at the client site?

Updates and Deletes using subqueries are not optimized and can run very
slowly on large result sets.  I would recommend writing a stored procedure
instead.

Dan
Technical Details
Message-ID: <418c1db5$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!transit.nntp.hccnet.nl!newsfeed.wirehub.nl!194.72.7.126.MISMATCH!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <418c133c$1@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: "Dan Palley" <dan@trams.com>
Newsgroups: borland.public.interbase.opensource
References: <418c133c$1@newsgroups.borland.com>
Subject: Re: Really Slow Delete on an System
Date: Fri, 5 Nov 2004 16:41:26 -0800
Lines: 41
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 157.238.54.65
Message-ID: <418c1db5$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1099701685 157.238.54.65 (5 Nov 2004 16:41:25 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!transit.nntp.hccnet.nl!newsfeed.wirehub.nl!194.72.7.126.MISMATCH!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail