Received: (qmail 10569 invoked from network); 9 Sep 2011 03:43:34 -0500
Received: from freelists-180.iquest.net (HELO turing.freelists.org) (206.53.239.180)
  by static-ip-85-25-126-90.inaddr.ip-pool.com with SMTP; 9 Sep 2011 03:41:36 -0500
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 58EB8E40506;
 Fri,  9 Sep 2011 04:32:00 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=freelists.org;
 s=turing; t=1315557120; bh=DNtDZ54ThRiK79Sh7cNzvuADOKq2eXqkmJHl8qTE
 9UU=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References:
	 In-Reply-To:Content-type:Content-Transfer-Encoding:Sender:Reply-To:
	 List-help:List-unsubscribe:List-Id:List-subscribe:List-owner:
	 List-post:List-archive; b=Xx/nR8Iid2wOjgs6jscItnPTEc5N/M0PH7Gk8LME
 Uxt+uyL6uRCVtaed6LB3m0hW02PVeauGX2Nl+gNksL+4tp5991nnY/llXsV5D72UhCo
 zj4+3v6hpi5C6tq+ZFNhsdKlYIg5j/L9twEDTSk0CcmTfp0iw6Y+aX4qcGjMQTOs=
X-Virus-Scanned: Debian amavisd-new at localhost.localdomain
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id r9rQRnpPgN61; Fri,  9 Sep 2011 04:32:00 -0400 (EDT)
Received: from turing.freelists.org (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 09A61E401C9;
 Fri,  9 Sep 2011 04:31:16 -0400 (EDT)
Received: with ECARTIS (v1.0.0; list oracle-l); Fri, 09 Sep 2011 04:30:36 -0400 (EDT)
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id A20D8E4017F
 for <oracle-l@freelists.org>; Fri,  9 Sep 2011 04:30:35 -0400 (EDT)
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id TufldGe09bkH for <oracle-l@freelists.org>;
 Fri,  9 Sep 2011 04:30:35 -0400 (EDT)
Received: from smtp23.services.sfr.fr (smtp23.services.sfr.fr [93.17.128.21])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 3638FE40177
 for <oracle-l@freelists.org>; Fri,  9 Sep 2011 04:30:28 -0400 (EDT)
Received: from filter.sfr.fr (localhost [127.0.0.1])
 by msfrf2313.sfr.fr (SMTP Server) with ESMTP id 8417C70000D7;
 Fri,  9 Sep 2011 10:29:53 +0200 (CEST)
Received: from [192.168.254.100] (140.126.204.77.rev.sfr.net [77.204.126.140])
 by msfrf2313.sfr.fr (SMTP Server) with ESMTP id F3FC570000D5;
 Fri,  9 Sep 2011 10:29:52 +0200 (CEST)
X-SFR-UUID: 20110909082952999.F3FC570000D5@msfrf2313.sfr.fr
Message-ID: <4E69CF1A.9000708@roughsea.com>
Date: Fri, 09 Sep 2011 10:32:26 +0200
From: Stephane Faroult <sfaroult@roughsea.com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.20) Gecko/20110804 SUSE/3.1.12 Thunderbird/3.1.12
MIME-Version: 1.0
To: jonathan@jlcomp.demon.co.uk
CC: Oracle L <oracle-l@freelists.org>
Subject: Re: getting in a little over my head
References: <D18D6513433DF04394041EA42B53E91C57884719@ICATEXCH2.ICAT.com> <4E69BFBE.6000803@roughsea.com> <840CC2221F934911BC8685C1400C7A7C@Primary>
In-Reply-To: <840CC2221F934911BC8685C1400C7A7C@Primary>
Content-type: text/plain
Content-Transfer-Encoding: 8bit
X-archive-position: 38679
X-ecartis-version: Ecartis v1.0.0
Sender: oracle-l-bounce@freelists.org
Errors-to: oracle-l-bounce@freelists.org
X-original-sender: sfaroult@roughsea.com
Precedence: normal
Reply-To: sfaroult@roughsea.com
List-help: <mailto:ecartis@freelists.org?Subject=help>
List-unsubscribe: <oracle-l-request@freelists.org?Subject=unsubscribe>
List-software: Ecartis version 1.0.0
List-Id: oracle-l <oracle-l.freelists.org>
X-List-ID: oracle-l <oracle-l.freelists.org>
List-subscribe: <oracle-l-request@freelists.org?Subject=subscribe>
List-owner: <mailto:steve.adams@ixora.com.au>
List-post: <mailto:oracle-l@freelists.org>
List-archive: <http://www.freelists.org/archives/oracle-l>
X-list: oracle-l

Jonathan,
      Or one or two DISTINCT, you are right. I always tend to put UNION 
ALL by default when I have different constants in my select list, but 
nothing says that objectid is unique in either quote for accountid, or 
in pol_policy for (accountid, logid).


-- 
Stephane Faroult
RoughSea Ltd <http://www.roughsea.com>
Konagora <http://www.konagora.com>
RoughSea Channel on Youtube <http://www.youtube.com/user/roughsealtd>


On 09/09/2011 10:17 AM, Jonathan Lewis wrote:
>
> Stephane,
>
> It depends on the uniqueness constraints, of course, but I think (based on the
> information we have so far)
> that the "UNION ALL" should be a "UNION".
>
> FROM (select objectid objid, 'Quote' linktype
>         FROM quote
>         WHERE accountid = 128847
>         union all
>         select objectid objid, 'Policy' linktype
>         FROM pol_policy
>         WHERE accountid = 128847
>           AND logid = 1) x
>
> Regards
>
> Jonathan Lewis
> http://jonathanlewis.wordpress.com
>
>
> ----- Original Message -----
> From: "Stephane Faroult"<sfaroult@roughsea.com>
> To:<JSweetser@icat.com>
> Cc: "Oracle L"<oracle-l@freelists.org>
> Sent: Friday, September 09, 2011 8:26 AM
> Subject: Re: getting in a little over my head
>
>
> Joe,
>       I have never been a great fan of execution plans but I have always
> hated multiple subqueries that kind of "sequentialize" everything. For
> me, everything depends in your query about the selectivity of accountid
> in tables quote and pol_policy, and my gut instinct would make me
> rewrite your query like this:
>
>
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>



--
http://www.freelists.org/webpage/oracle-l


