pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jim C. Nasby <jnasby@pervasive.com>
To: Sriram Dandapani <sdandapani@counterpane.com>
Cc: Pgsql-Performance (E-mail) <pgsql-performance@postgresql.org>
Subject: Re: planner not using index for like operator
Date: Tue, 25 Apr 2006 13:24:45 -0500
Message-ID: <20060425182444.GK97354@pervasive.com> (raw)
In-Reply-To: <6992E470F12A444BB787B5C937B9D4DF0406B241@ca-mail1.cis.local>
References: <6992E470F12A444BB787B5C937B9D4DF0406B241@ca-mail1.cis.local>

On Tue, Apr 25, 2006 at 10:08:02AM -0700, Sriram Dandapani wrote:
Here's the key:

> "  Filter: ((col1)::text ~~ '172.%'::text)"

In order to do a like comparison, it has to convert col1 (which I'm
guessing is of type 'inet') to text, so there's no way it can use an
index on col1 (maybe a function index, but that's a different story).

Is there some reason you're not doing

WHERE col1 <<= '172/8'::inet

?
-- 
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461



view thread (5+ messages)  latest in thread

Message-ID: <20060425182444.GK97354@pervasive.com>
Permalink:  ../20060425182444.GK97354@pervasive.com/
Also on:    postgresql.org/message-id/20060425182444.GK97354@pervasive.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: jnasby@pervasive.com, sdandapani@counterpane.com
  Subject: Re: planner not using index for like operator
  In-Reply-To: <20060425182444.GK97354@pervasive.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox