Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 47F5E9FB2E2 for ; Sun, 18 Mar 2007 22:21:59 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 22301-08 for ; Sun, 18 Mar 2007 22:21:56 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from web54308.mail.yahoo.com (web54308.mail.yahoo.com [206.190.49.118]) by postgresql.org (Postfix) with SMTP id C0BF99FB2C1 for ; Sun, 18 Mar 2007 22:21:56 -0300 (ADT) Received: (qmail 78947 invoked by uid 60001); 19 Mar 2007 01:21:54 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=4K1fs5POR1FMUNErcp84XinfcWdc6iDsS666+1vtOlvYrpk2pfzAm0VxIsVuJPHQXpqM8fILIcaQAqszbQGuW+l6/UGPsj4sluPdaMyWJovsscQPx/k0sWwXoqXQUCBTLnEWiXVh7S28PdgdcS3SpzjuNAt7qM48R8fsYHoXFdc=; X-YMail-OSG: wlqbnqIVM1mg.Qb5xtgW7lNyg4klvyyknGgfcTE2N7fPEMlPKV9sa2dn_7iwYnyfBVGNoMPheDeN9aN9ImZtlUx3IaHwkKpvt5GqKvfKqaaZn.nZ7qnqKl.60EZBgKBM6rEsuYPog17oKFcDCdee8X6DdQ-- Received: from [24.10.123.39] by web54308.mail.yahoo.com via HTTP; Sun, 18 Mar 2007 18:21:54 PDT Date: Sun, 18 Mar 2007 18:21:54 -0700 (PDT) From: chester c young Subject: better approach: case or join To: sql pgsql MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <828472.77350.qm@web54308.mail.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/240 X-Sequence-Number: 27878 from id extracting name from several tables. which is generally the better approach? select case when tab_tla='usr' then (select name from users where ... ) case when tab_tla='con' then (select title from contents where ...) end as name; as versus select name from users where tab_tla='usr' and ... join select title from contents where tab_tla='con' and ... I assume the former since the optimizer does not examine whether the entire where clause might be false before executing the query. thanks, chester ____________________________________________________________________________________ Don't pick lemons. See all the new 2007 cars at Yahoo! Autos. http://autos.yahoo.com/new_cars.html