🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.vdbase.data.sql
Article #42

Re: SQL OUTER JOIN giving unpredictable results

#42
From: Mark Berry
Date: Mon, 22 Feb 1999 00:00
29 lines
1838 bytes
Roamin,

Romain Strieff [TeamB] wrote:
> If the result is readonly you won't be able to delete them, behaveing or
> not. I'm by no stretch of imagination an SQL guy, but this works for me,
> try it out.
> 
> DELETE FROM MASTER M WHERE NOT M.ORDER_ID IN;
>       (SELECT ORDER_ID FROM CHILD C WHERE c.ORDER_ID=M.ORDER_ID)

Thanks, that works great on my sample data and makes sense to my simple
mind (select the good ones, then NOT them).  It also doesn't seem to
create the huge temporary tables created by a JOIN.  I was actually
testing with "SELECT *" in place of "DELETE", since I want to give the
user the opportunity to review the records before deleting them.

The problem comes when run on production-size tables.  I've got five
tables to check.  The master is about 4000 records; the child tables
range from 4000 to 55,000.  I finally killed the process after an hour. 
It CPU-bound, I think--NT Task Manager showed it running at 81% of my
Pentium Pro 200 the whole time, and I didn't hear a lot of disk
swapping.

I'm beginning to wonder if it wouldn't be simpler to just loop through
each table and do a findKey() based on each record.  WDYT?

Thanks much for your help!

Mark Berry
Technical Details
Message-ID: <36D1B713.8E3E747B@nospam.mcbsys.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36CE28AB.704C343B@nospam.mcbsys.com> <MPG.1138ae8f9e4467a8989e73@forums.inprise.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff5a1,3dc8d9196f7bc07d
X-Google-Attributes: gidff5a1,public
From: Mark Berry <markb@nospam.mcbsys.com>
Subject: Re: SQL OUTER JOIN giving unpredictable results
Date: 1999/02/22
Message-ID: <36D1B713.8E3E747B@nospam.mcbsys.com>
X-Deja-AN: 447198534
Content-Transfer-Encoding: 7bit
References: <36CE28AB.704C343B@nospam.mcbsys.com> <MPG.1138ae8f9e4467a8989e73@forums.inprise.com>
Content-Type: text/plain; charset=us-ascii
Organization: MCB Systems
Mime-Version: 1.0
Reply-To: markb@nospam.mcbsys.com
Newsgroups: borland.public.vdbase.data.sql