Re: NOT IN performance problem

2002-07-16 Thread Abul Fazal

Select personid from person
minus
select personid from phonenumber

Fazal
--- "Dennis M. Heisler" <[EMAIL PROTECTED]>
wrote:
> select personid from person
> where not exists (select '1' from phonenumber
> where personid = person.personid);
> 
> Nils Höglund wrote:
> > 
> > Hello,
> > 
> > I have encountered a performance problem. I use
> "Oracle8 Enterprise Edition
> > Release 8.0.5.0.0 - Production."
> > 
> > I have two tables. "phonenumber" and "person",
> each person has none, one or
> > many phonenumbers referenced to him.
> > 
> > The phonenumber-table is structured like:
> > phonenumber.personid
> > phonenumber.phonenumber
> > 
> > The person-table is structured like:
> > person.personid
> > person.name
> > person.address
> > 
> > I wan't to know which persons that does NOT have
> any phonenumber(s).
> > 
> > I can write the query as:
> > SELECT personid FROM phonenumber WHERE personid
> NOT IN (
> >SELECT personid FROM person);
> > 
> > However, since my tables are quite large, it takes
> forever to run my query.
> > In the real database both (or
> > atleast one) of "person" or "phonenumber" are
> views.
> > 
> > To figure out who _does_ have phonenumbers is
> SIGNIFICANTLY faster.
> > (SELECT DISTINCT person.personid FROM person,
> phonenumber WHERE
> > person.personid=phonenumber.personid)
> > 
> > I'm wondering how I could restructure or rewrite
> my query ("who doesn't have
> > any phoinenumbers?") to run faster,
> > or if there is anything else I can do to optimize
> the query?
> > 
> > Any suggestions?
> > 
> > --
> > /Nils Höglund, Naqua KB
> > 
> > E-mail: [EMAIL PROTECTED]
> > Web:http://www.naqua.se/
> > Home Phone: +46 (0)18  30 09 19
> > Cellular Phone: +46 (0)736 51 74 58
> > Address:Nya Valsätrav. 26 B
> > SE-756 46
> > Uppsala, Sweden
> > --
> > Please see the official ORACLE-L FAQ:
> http://www.orafaq.com
> > --
> > Author: =?iso-8859-1?Q?Nils_H=F6glund?=
> >   INET: [EMAIL PROTECTED]
> > 
> > Fat City Network Services-- (858) 538-5051 
> FAX: (858) 538-5051
> > San Diego, California-- Public Internet
> access / Mailing Lists
> >
>

> > To REMOVE yourself from this mailing list, send an
> E-Mail message
> > to: [EMAIL PROTECTED] (note EXACT spelling of
> 'ListGuru') and in
> > the message BODY, include a line containing: UNSUB
> ORACLE-L
> > (or the name of mailing list you want to be
> removed from).  You may
> > also send the HELP command for other information
> (like subscribing).
> -- 
> Please see the official ORACLE-L FAQ:
> http://www.orafaq.com
> -- 
> Author: Dennis M. Heisler
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services-- (858) 538-5051  FAX:
> (858) 538-5051
> San Diego, California-- Public Internet
> access / Mailing Lists
>

> To REMOVE yourself from this mailing list, send an
> E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of
> 'ListGuru') and in
> the message BODY, include a line containing: UNSUB
> ORACLE-L
> (or the name of mailing list you want to be removed
> from).  You may
> also send the HELP command for other information
> (like subscribing).


=
Abul Fazal
Production Support Services - Quantum Leap 
Standard Charted Bank 
Singapore
HP : 65-94887900

__
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Abul Fazal
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: NOT IN performance problem

2002-06-25 Thread Nils Höglund


> I'm not sure what you want since your query doesn't correspond to what
> you are saying you want. Therefore no sample just a general statement,
> use minus.
> 
> > SELECT personid FROM phonenumber WHERE personid NOT IN (
> >SELECT personid FROM person);
> >
> > I'm wondering how I could restructure or rewrite my query ("who doesn't have
> > any phoinenumbers?") to run faster, 
> > or if there is anything else I can do to optimize the query?

I'm sorry. I miss-wrote.

It should be:

SELECT personid FROM person WHERE personid NOT IN (
   SELECT personid FROM phonenumber)
   

Thanks!

-- 
/Nils Höglund, Naqua KB

E-mail: [EMAIL PROTECTED]
Web:http://www.naqua.se/
Home Phone: +46 (0)18  30 09 19
Cellular Phone: +46 (0)736 51 74 58
Address:Nya Valsätrav. 26 B
SE-756 46
Uppsala, Sweden
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: =?iso-8859-1?Q?Nils_H=F6glund?=
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: NOT IN performance problem

2002-06-25 Thread Jared . Still

Finally!   :)





Richard Huntley <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
06/25/2002 07:48 AM
Please respond to ORACLE-L

 
To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]>
cc: 
Subject:        RE: NOT IN performance problem


Nils, try this...(replaces NOT IN with an Outer Join) 
select a.id from person a, phonenumber b 
where a.id = b.id(+) 
and b.id is null; 
-Original Message- 
Sent: Tuesday, June 25, 2002 9:08 AM 
To: Multiple recipients of list ORACLE-L 



Hello, 
I have encountered a performance problem. I use "Oracle8 Enterprise 
Edition 
Release 8.0.5.0.0 - Production." 
I have two tables. "phonenumber" and "person", each person has none, one 
or 
many phonenumbers referenced to him. 
The phonenumber-table is structured like: 
phonenumber.personid 
phonenumber.phonenumber 
The person-table is structured like: 
person.personid 
person.name 
person.address 

I wan't to know which persons that does NOT have any phonenumber(s). 
I can write the query as: 
SELECT personid FROM phonenumber WHERE personid NOT IN ( 
   SELECT personid FROM person); 
 
However, since my tables are quite large, it takes forever to run my 
query. 
In the real database both (or 
atleast one) of "person" or "phonenumber" are views. 
To figure out who _does_ have phonenumbers is SIGNIFICANTLY faster. 
(SELECT DISTINCT person.personid FROM person, phonenumber WHERE 
person.personid=phonenumber.personid) 
I'm wondering how I could restructure or rewrite my query ("who doesn't 
have 
any phoinenumbers?") to run faster, 
or if there is anything else I can do to optimize the query? 
Any suggestions? 

-- 
/Nils Höglund, Naqua KB 
E-mail: [EMAIL PROTECTED] 
Web:http://www.naqua.se/ 
Home Phone: +46 (0)18  30 09 19 
Cellular Phone: +46 (0)736 51 74 58 
Address:Nya Valsätrav. 26 B 
SE-756 46 
Uppsala, Sweden 
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com 
-- 
Author: =?iso-8859-1?Q?Nils_H=F6glund?= 
  INET: [EMAIL PROTECTED] 
Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051 
San Diego, California-- Public Internet access / Mailing Lists 
 
To REMOVE yourself from this mailing list, send an E-Mail message 
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in 
the message BODY, include a line containing: UNSUB ORACLE-L 
(or the name of mailing list you want to be removed from).  You may 
also send the HELP command for other information (like subscribing). 


--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author:
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: NOT IN performance problem

2002-06-25 Thread Charlie Mengler

select personid from person_table
minus
select personid from phonenumber_table
/

Nils Höglund wrote:
> 
> Hello,
> 
> I have encountered a performance problem. I use "Oracle8 Enterprise Edition
> Release 8.0.5.0.0 - Production."
> 
> I have two tables. "phonenumber" and "person", each person has none, one or
> many phonenumbers referenced to him.
> 
> The phonenumber-table is structured like:
> phonenumber.personid
> phonenumber.phonenumber
> 
> The person-table is structured like:
> person.personid
> person.name
> person.address
> 
> I wan't to know which persons that does NOT have any phonenumber(s).
> 
> I can write the query as:
> SELECT personid FROM phonenumber WHERE personid NOT IN (
>SELECT personid FROM person);
> 
> However, since my tables are quite large, it takes forever to run my query.
> In the real database both (or
> atleast one) of "person" or "phonenumber" are views.
> 
> To figure out who _does_ have phonenumbers is SIGNIFICANTLY faster.
> (SELECT DISTINCT person.personid FROM person, phonenumber WHERE
> person.personid=phonenumber.personid)
> 
> I'm wondering how I could restructure or rewrite my query ("who doesn't have
> any phoinenumbers?") to run faster,
> or if there is anything else I can do to optimize the query?
> 
> Any suggestions?
> 
> --
> /Nils Höglund, Naqua KB
> 
> E-mail: [EMAIL PROTECTED]
> Web:http://www.naqua.se/
> Home Phone: +46 (0)18  30 09 19
> Cellular Phone: +46 (0)736 51 74 58
> Address:Nya Valsätrav. 26 B
> SE-756 46
> Uppsala, Sweden
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: =?iso-8859-1?Q?Nils_H=F6glund?=
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
> San Diego, California-- Public Internet access / Mailing Lists
> 
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other information (like subscribing).

-- 
Charlie Mengler  Maintenance Warehouse  
[EMAIL PROTECTED] 10641 Scripps Summit Ct.
858-831-2229 The Micro$oft Haiku Creed   San Diego, CA 92131
Chaos reigns within. Reflect, repent, and reboot. Order shall return.
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Charlie Mengler
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: NOT IN performance problem

2002-06-25 Thread Pat Hildebrand


> 
> 
> 
> Hello,
> 
> I have encountered a performance problem. I use "Oracle8 Enterprise Edition
> Release 8.0.5.0.0 - Production."
> 
> I have two tables. "phonenumber" and "person", each person has none, one or
> many phonenumbers referenced to him.
I'm not sure what you want since your query doesn't correspond to what
you are saying you want. Therefore no sample just a general statement,
use minus.

 Pat




> 
> The phonenumber-table is structured like:
> phonenumber.personid
> phonenumber.phonenumber
> 
> The person-table is structured like:
> person.personid
> person.name
> person.address
> 
> 
> I wan't to know which persons that does NOT have any phonenumber(s).
> 
> I can write the query as:
> SELECT personid FROM phonenumber WHERE personid NOT IN (
>SELECT personid FROM person);
>
> However, since my tables are quite large, it takes forever to run my query.
> In the real database both (or
> atleast one) of "person" or "phonenumber" are views.
> 
> To figure out who _does_ have phonenumbers is SIGNIFICANTLY faster.
> (SELECT DISTINCT person.personid FROM person, phonenumber WHERE
> person.personid=phonenumber.personid)
> 
> I'm wondering how I could restructure or rewrite my query ("who doesn't have
> any phoinenumbers?") to run faster, 
> or if there is anything else I can do to optimize the query?
> 
> Any suggestions?
> 
> 
> -- 
> /Nils Höglund, Naqua KB
> 
> E-mail: [EMAIL PROTECTED]
> Web:http://www.naqua.se/
> Home Phone: +46 (0)18  30 09 19
> Cellular Phone: +46 (0)736 51 74 58
> Address:Nya Valsätrav. 26 B
> SE-756 46
> Uppsala, Sweden
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> -- 
> Author: =?iso-8859-1?Q?Nils_H=F6glund?=
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
> San Diego, California-- Public Internet access / Mailing Lists
> 
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other information (like subscribing).
> 

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Pat Hildebrand
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: NOT IN performance problem

2002-06-25 Thread Richard Huntley
Title: RE: NOT IN performance problem





Nils, try this...(replaces NOT IN with an Outer Join)


select a.id from person a, phonenumber b
where a.id = b.id(+)
and b.id is null;


-Original Message-
From: Nils Höglund [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 25, 2002 9:08 AM
To: Multiple recipients of list ORACLE-L
Subject: NOT IN performance problem





Hello,


I have encountered a performance problem. I use "Oracle8 Enterprise Edition
Release 8.0.5.0.0 - Production."


I have two tables. "phonenumber" and "person", each person has none, one or
many phonenumbers referenced to him.


The phonenumber-table is structured like:
phonenumber.personid
phonenumber.phonenumber


The person-table is structured like:
person.personid
person.name
person.address



I wan't to know which persons that does NOT have any phonenumber(s).


I can write the query as:
SELECT personid FROM phonenumber WHERE personid NOT IN (
   SELECT personid FROM person);
   
However, since my tables are quite large, it takes forever to run my query.
In the real database both (or
atleast one) of "person" or "phonenumber" are views.


To figure out who _does_ have phonenumbers is SIGNIFICANTLY faster.
(SELECT DISTINCT person.personid FROM person, phonenumber WHERE
person.personid=phonenumber.personid)


I'm wondering how I could restructure or rewrite my query ("who doesn't have
any phoinenumbers?") to run faster, 
or if there is anything else I can do to optimize the query?


Any suggestions?



-- 
/Nils Höglund, Naqua KB


E-mail: [EMAIL PROTECTED]
Web:    http://www.naqua.se/
Home Phone: +46 (0)18  30 09 19
Cellular Phone: +46 (0)736 51 74 58
Address:    Nya Valsätrav. 26 B
    SE-756 46
    Uppsala, Sweden
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: =?iso-8859-1?Q?Nils_H=F6glund?=
  INET: [EMAIL PROTECTED]


Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California    -- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).





Re: NOT IN performance problem

2002-06-25 Thread Yechiel Adar

Maybe you can get faster results with minus:
select distinct personid from persons
minus
select distinct personid from phones

Yechiel Adar
Mehish
- Original Message -
To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]>
Sent: Tuesday, June 25, 2002 3:08 PM


>
>
> Hello,
>
> I have encountered a performance problem. I use "Oracle8 Enterprise
Edition
> Release 8.0.5.0.0 - Production."
>
> I have two tables. "phonenumber" and "person", each person has none, one
or
> many phonenumbers referenced to him.
>
> The phonenumber-table is structured like:
> phonenumber.personid
> phonenumber.phonenumber
>
> The person-table is structured like:
> person.personid
> person.name
> person.address
>
>
> I wan't to know which persons that does NOT have any phonenumber(s).
>
> I can write the query as:
> SELECT personid FROM phonenumber WHERE personid NOT IN (
>SELECT personid FROM person);
>
> However, since my tables are quite large, it takes forever to run my
query.
> In the real database both (or
> atleast one) of "person" or "phonenumber" are views.
>
> To figure out who _does_ have phonenumbers is SIGNIFICANTLY faster.
> (SELECT DISTINCT person.personid FROM person, phonenumber WHERE
> person.personid=phonenumber.personid)
>
> I'm wondering how I could restructure or rewrite my query ("who doesn't
have
> any phoinenumbers?") to run faster,
> or if there is anything else I can do to optimize the query?
>
> Any suggestions?
>
>
> --
> /Nils Höglund, Naqua KB
>
> E-mail: [EMAIL PROTECTED]
> Web:http://www.naqua.se/
> Home Phone: +46 (0)18  30 09 19
> Cellular Phone: +46 (0)736 51 74 58
> Address:Nya Valsätrav. 26 B
> SE-756 46
> Uppsala, Sweden
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: =?iso-8859-1?Q?Nils_H=F6glund?=
>   INET: [EMAIL PROTECTED]
>
> Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
> San Diego, California-- Public Internet access / Mailing Lists
> 
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Yechiel Adar
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: NOT IN performance problem

2002-06-25 Thread Jan Pruner

Try EXISTS.
SELECT personid FROM person WHERE NOT EXISTS (
SELECT 0 FROM phonenumber WHERE person.personid=phonenumber.personid
);
You'll get all persons without any telephone number.

JP


On Tuesday 25 June 2002 15:08, Nils Höglund wrote:
> Hello,
>
> I have encountered a performance problem. I use "Oracle8 Enterprise Edition
> Release 8.0.5.0.0 - Production."
>
> I have two tables. "phonenumber" and "person", each person has none, one or
> many phonenumbers referenced to him.
>
> The phonenumber-table is structured like:
> phonenumber.personid
> phonenumber.phonenumber
>
> The person-table is structured like:
> person.personid
> person.name
> person.address
>
>
> I wan't to know which persons that does NOT have any phonenumber(s).
>
> I can write the query as:
> SELECT personid FROM phonenumber WHERE personid NOT IN (
>SELECT personid FROM person);
>
> However, since my tables are quite large, it takes forever to run my query.
> In the real database both (or
> atleast one) of "person" or "phonenumber" are views.
>
> To figure out who _does_ have phonenumbers is SIGNIFICANTLY faster.
> (SELECT DISTINCT person.personid FROM person, phonenumber WHERE
> person.personid=phonenumber.personid)
>
> I'm wondering how I could restructure or rewrite my query ("who doesn't
> have any phoinenumbers?") to run faster,
> or if there is anything else I can do to optimize the query?
>
> Any suggestions?

-- 
 Pruner Jan
   [EMAIL PROTECTED]
 http://jan.pruner.cz/
-
Only Robinson Crusoe had all his work done by Friday
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Jan Pruner
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: NOT IN performance problem

2002-06-25 Thread Alexandre Gorbatchev

Move to EXISTS like this:

SELECT pn.personid
FROM phonenumber pn
WHERE NOT EXISTS (
SELECT NULL
FROM person p
WHERE p.personid=pn.personid);

--
hth
Alexandre

- Original Message -
To: "Multiple recipients of list ORACLE-L" <[EMAIL PROTECTED]>
Sent: Tuesday, June 25, 2002 3:08 PM


>
>
> Hello,
>
> I have encountered a performance problem. I use "Oracle8 Enterprise
Edition
> Release 8.0.5.0.0 - Production."
>
> I have two tables. "phonenumber" and "person", each person has none, one
or
> many phonenumbers referenced to him.
>
> The phonenumber-table is structured like:
> phonenumber.personid
> phonenumber.phonenumber
>
> The person-table is structured like:
> person.personid
> person.name
> person.address
>
>
> I wan't to know which persons that does NOT have any phonenumber(s).
>
> I can write the query as:
> SELECT personid FROM phonenumber WHERE personid NOT IN (
>SELECT personid FROM person);
>
> However, since my tables are quite large, it takes forever to run my
query.
> In the real database both (or
> atleast one) of "person" or "phonenumber" are views.
>
> To figure out who _does_ have phonenumbers is SIGNIFICANTLY faster.
> (SELECT DISTINCT person.personid FROM person, phonenumber WHERE
> person.personid=phonenumber.personid)
>
> I'm wondering how I could restructure or rewrite my query ("who doesn't
have
> any phoinenumbers?") to run faster,
> or if there is anything else I can do to optimize the query?
>
> Any suggestions?
>
>
> --
> /Nils Höglund, Naqua KB
>
> E-mail: [EMAIL PROTECTED]
> Web:http://www.naqua.se/
> Home Phone: +46 (0)18  30 09 19
> Cellular Phone: +46 (0)736 51 74 58
> Address:Nya Valsätrav. 26 B
> SE-756 46
> Uppsala, Sweden
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: =?iso-8859-1?Q?Nils_H=F6glund?=
>   INET: [EMAIL PROTECTED]
>
> Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
> San Diego, California-- Public Internet access / Mailing Lists
> 
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other information (like subscribing).
>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Alexandre Gorbatchev
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: NOT IN performance problem

2002-06-25 Thread Stephane Faroult

C'mon, Larry, don't be shy :-)

>
>Hello,
>
>I have encountered a performance problem. I use
>"Oracle8 Enterprise Edition
>Release 8.0.5.0.0 - Production."
>
>I have two tables. "phonenumber" and "person", each
>person has none, one or
>many phonenumbers referenced to him.
>
>The phonenumber-table is structured like:
>phonenumber.personid
>phonenumber.phonenumber
>
>The person-table is structured like:
>person.personid
>person.name
>person.address
>
>
>I wan't to know which persons that does NOT have
>any phonenumber(s).
>
>I can write the query as:
>SELECT personid FROM phonenumber WHERE personid NOT
>IN (
>   SELECT personid FROM person);
>   
>However, since my tables are quite large, it takes
>forever to run my query.
>In the real database both (or
>atleast one) of "person" or "phonenumber" are
>views.
>
>To figure out who _does_ have phonenumbers is
>SIGNIFICANTLY faster.
>(SELECT DISTINCT person.personid FROM person,
>phonenumber WHERE
>person.personid=phonenumber.personid)
>
>I'm wondering how I could restructure or rewrite my
>query ("who doesn't have
>any phoinenumbers?") to run faster, 
>or if there is anything else I can do to optimize
>the query?
>
>Any suggestions?
>
>
>-- 
>/Nils Höglund, Naqua KB
>
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stephane Faroul
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: NOT IN performance problem

2002-06-25 Thread Dennis M. Heisler

select personid from person
where not exists (select '1' from phonenumber
where personid = person.personid);

Nils Höglund wrote:
> 
> Hello,
> 
> I have encountered a performance problem. I use "Oracle8 Enterprise Edition
> Release 8.0.5.0.0 - Production."
> 
> I have two tables. "phonenumber" and "person", each person has none, one or
> many phonenumbers referenced to him.
> 
> The phonenumber-table is structured like:
> phonenumber.personid
> phonenumber.phonenumber
> 
> The person-table is structured like:
> person.personid
> person.name
> person.address
> 
> I wan't to know which persons that does NOT have any phonenumber(s).
> 
> I can write the query as:
> SELECT personid FROM phonenumber WHERE personid NOT IN (
>SELECT personid FROM person);
> 
> However, since my tables are quite large, it takes forever to run my query.
> In the real database both (or
> atleast one) of "person" or "phonenumber" are views.
> 
> To figure out who _does_ have phonenumbers is SIGNIFICANTLY faster.
> (SELECT DISTINCT person.personid FROM person, phonenumber WHERE
> person.personid=phonenumber.personid)
> 
> I'm wondering how I could restructure or rewrite my query ("who doesn't have
> any phoinenumbers?") to run faster,
> or if there is anything else I can do to optimize the query?
> 
> Any suggestions?
> 
> --
> /Nils Höglund, Naqua KB
> 
> E-mail: [EMAIL PROTECTED]
> Web:http://www.naqua.se/
> Home Phone: +46 (0)18  30 09 19
> Cellular Phone: +46 (0)736 51 74 58
> Address:Nya Valsätrav. 26 B
> SE-756 46
> Uppsala, Sweden
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: =?iso-8859-1?Q?Nils_H=F6glund?=
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
> San Diego, California-- Public Internet access / Mailing Lists
> 
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Dennis M. Heisler
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



NOT IN performance problem

2002-06-25 Thread Nils Höglund



Hello,

I have encountered a performance problem. I use "Oracle8 Enterprise Edition
Release 8.0.5.0.0 - Production."

I have two tables. "phonenumber" and "person", each person has none, one or
many phonenumbers referenced to him.

The phonenumber-table is structured like:
phonenumber.personid
phonenumber.phonenumber

The person-table is structured like:
person.personid
person.name
person.address


I wan't to know which persons that does NOT have any phonenumber(s).

I can write the query as:
SELECT personid FROM phonenumber WHERE personid NOT IN (
   SELECT personid FROM person);
   
However, since my tables are quite large, it takes forever to run my query.
In the real database both (or
atleast one) of "person" or "phonenumber" are views.

To figure out who _does_ have phonenumbers is SIGNIFICANTLY faster.
(SELECT DISTINCT person.personid FROM person, phonenumber WHERE
person.personid=phonenumber.personid)

I'm wondering how I could restructure or rewrite my query ("who doesn't have
any phoinenumbers?") to run faster, 
or if there is anything else I can do to optimize the query?

Any suggestions?


-- 
/Nils Höglund, Naqua KB

E-mail: [EMAIL PROTECTED]
Web:http://www.naqua.se/
Home Phone: +46 (0)18  30 09 19
Cellular Phone: +46 (0)736 51 74 58
Address:Nya Valsätrav. 26 B
SE-756 46
Uppsala, Sweden
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: =?iso-8859-1?Q?Nils_H=F6glund?=
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).