Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 15226632501 for ; Thu, 18 Feb 2010 08:40:58 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 92770-07 for ; Thu, 18 Feb 2010 12:40:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.156]) by mail.postgresql.org (Postfix) with ESMTP id D29116324C2 for ; Thu, 18 Feb 2010 08:40:46 -0400 (AST) Received: by fg-out-1718.google.com with SMTP id 19so686181fgg.1 for ; Thu, 18 Feb 2010 04:40:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=2OAoMmzYTGc4AFVzAr1YzVL7nt97R/sPV0TeeHzlMYE=; b=LOEoPLHZ3vOAo+LmBKhAlkGItSM59wixpWM0agM+VJ3ToBbATSt2M2kwQQq5CrEUO+ fBMpsKmtelbbDIz0p+WcF1Kv8rJQp8dlHw20Aqc/2g+kKdOhV4SCw3XmfgYBjLzu79lW liqj3pfKe7nfTcZ8JPnXwnKqlIhTxSY1GSHQw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=J4DztlzmoYi2Jr+QhdqMSK6ayjAsFTHbI/LWE4QDXenl6x68rIb68QHUHzzaX2LmHl 4eiE5IDiKLjeAcbiKJwgprEZRuMcT9QgUBbPZaXWxAkq9cFv6lcHgGNdTX+ZJF8pjZoT sTWK4auUsCvJCEUjPM0vI0Rog/CBs1cjzAR/A= MIME-Version: 1.0 Received: by 10.102.211.39 with SMTP id j39mr7000461mug.106.1266496844119; Thu, 18 Feb 2010 04:40:44 -0800 (PST) In-Reply-To: <20100218121810.GG23676@a-kretschmer.de> References: <2a7905441002180355w6dc89a87y8643c0a7f881072a@mail.gmail.com> <20100218121810.GG23676@a-kretschmer.de> From: Thom Brown Date: Thu, 18 Feb 2010 12:40:23 +0000 Message-ID: Subject: Re: index usage in not like To: "A. Kretschmer" Cc: pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.529 tagged_above=-10 required=5 tests=AWL=-0.419, BAYES_05=-1.11 X-Spam-Level: X-Archive-Number: 201002/275 X-Sequence-Number: 37696 On 18 February 2010 12:18, A. Kretschmer wrote: > In response to Thom Brown : >> On 18 February 2010 11:55, AI Rumman wrote: >> > "Not like" operation does not use index. >> > >> > select * from vtiger_contactscf where lower(cf_1253) not like >> > lower('Former%') >> > >> > I created index on lower(cf_1253). >> > >> > How can I ensure index usage in not like operation? >> > Anyone please help. >> > >> >> How many rows do you have in your table? =A0If there are relatively few, >> it probably guesses it to be cheaper to do a sequential scan and >> calculate lower values on-the-fly rather than bother with the index. > > That's one reason, an other reason, i think, is, that a btree-index can't > search with an 'not like' - operator. > Erm.. yes. Now that you say it, it's obvious. :S Thom