Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 719609FC200 for ; Thu, 15 Mar 2007 11:19:37 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 18129-01-4 for ; Thu, 15 Mar 2007 11:19:31 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by postgresql.org (Postfix) with ESMTP id 7DA439FC1CE for ; Thu, 15 Mar 2007 11:16:50 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1HRqkh-0008AL-Ok for pgsql-sql@postgresql.org; Thu, 15 Mar 2007 15:16:23 +0100 Received: from cc503261-a.eelde1.dr.home.nl ([212.204.130.190]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 15 Mar 2007 15:16:23 +0100 Received: from halfgaar by cc503261-a.eelde1.dr.home.nl with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 15 Mar 2007 15:16:23 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Wiebe Cazemier Subject: Re: Joins on many-to-many relations. Date: Thu, 15 Mar 2007 15:16:07 +0100 Lines: 11 Message-ID: References: <5.2.1.1.0.20070314133826.050002b0@pop6.sympatico.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8Bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: cc503261-a.eelde1.dr.home.nl User-Agent: KNode/0.10.4 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/212 X-Sequence-Number: 27850 On Thursday 15 March 2007 15:05, Rodrigo De León wrote: > From http://www.postgresql.org/docs/8.2/static/indexes-types.html : > > "The optimizer can also use a B-tree index for queries involving the > pattern matching operators LIKE and ~ if the pattern is a constant and > is anchored to the beginning of the string ? for example, col LIKE > 'foo%' or col ~ '^foo', but not col LIKE '%bar'." It made the query faster (1500 instead of 2500 ms), but not fast enough. But, this is good to know, although I often need the '%foobar%' search string...