Re: [PERFORM] planner not using index for like operator

2006-04-25 Thread Sriram Dandapani
inet data type to see if there are differences. Sriram -Original Message- From: Jim C. Nasby [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 25, 2006 11:25 AM To: Sriram Dandapani Cc: Pgsql-Performance (E-mail) Subject: Re: [PERFORM] planner not using index for like operator On Tue, Apr 2

Re: [PERFORM] planner not using index for like operator

2006-04-25 Thread Sriram Dandapani
the inet data type? Thanks Sriram -Original Message- From: Jim C. Nasby [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 25, 2006 11:25 AM To: Sriram Dandapani Cc: Pgsql-Performance (E-mail) Subject: Re: [PERFORM] planner not using index for like operator On Tue, Apr 25, 2006 at 10:08

Re: [PERFORM] planner not using index for like operator

2006-04-25 Thread Jim C. Nasby
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

Re: [PERFORM] planner not using index for like operator

2006-04-25 Thread Dave Dutcher
PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sriram DandapaniSent: Tuesday, April 25, 2006 12:08 PMTo: Pgsql-Performance (E-mail)Subject: [PERFORM] planner not using index for like operator For the query     Select col1 from table1 Where col1 like ‘172

[PERFORM] planner not using index for like operator

2006-04-25 Thread Sriram Dandapani
For the query     Select col1 from table1 Where col1 like ‘172.%’   The table has 133 million unique ip addresses. Col1 is indexed.   The optimizer is using a sequential scan   This is the explain analyze output   "Seq Scan on table1 (cost=0.00..2529284.80 rows=1 width=15) (actu