Received: from joeconway.com (unknown [63.210.180.150]) by postgresql.org (Postfix) with ESMTP id C2989475AA7 for ; Wed, 27 Mar 2002 11:36:13 -0500 (EST) Received: from [206.19.64.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 3.5.6) with ESMTP-TLS id 312545; Wed, 27 Mar 2002 08:30:24 -0800 Message-ID: <3CA1F4FF.5000609@joeconway.com> Date: Wed, 27 Mar 2002 08:36:15 -0800 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.9) Gecko/20020311 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jodi Kanter Cc: Postgres Admin List Subject: Re: join vs. IN statement References: <005501c1d5a6$6c9a6630$de138f80@virginia.edu> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Archive-Number: 200203/324 X-Sequence-Number: 3858 Jodi Kanter wrote: > We are currently trying to determine if their is a performance > difference with postgres in using an IN statement in the where clause > vs. using a join between tables. > > Is there any published documentation or someone with personal experience > that can answer this question? We are adding sessioning to our web > interface and plan to append security info to the queries run from the > interface. > > I can add something like: ....... AND WHERE user IN (group1, group2) > > or I can do something like ....... SELECT data FROM tables WHERE > group_ID(of one table) = group_ID(of another table). > > Any thoughts? > IN is known for being slow. See: http://www.us.postgresql.org/docs/faq-english.html#4.22 Joe