Re: Index not being used ?

From: Adam Kavan <akavan(at)cox(dot)net>
To: Carlos G Mendioroz <tron(at)huapi(dot)ba(dot)ar>, pgsql-general(at)postgresql(dot)org
Subject: Re: Index not being used ?
Date: 2003-09-03 21:34:22
Message-ID: 5.2.1.1.0.20030903163241.00a58a50@pop.central.cox.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


>CREATE TABLE public.base (
> nombre varchar(255),
> calle varchar(255),
> puerta int2,
> resto varchar(255),
> lid int2,
> area varchar(4),
> telefono varchar(10)
>)
>CREATE INDEX base_dir ON base USING btree (lid, calle, puerta);
>
>And trying the following select:
>
>select * from base where lid = 457 and calle = 'MALABIA' and puerta = 10

I think its because lid and puerta are int2's and 457 and 10 are
int4's. Try lid = '457'::int2 and puerta = '10'::int2. To use an index
the variables have to match types exactly.

--- Adam Kavan
--- akavan(at)cox(dot)net

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adam Kavan 2003-09-03 21:38:45 Re: pg_autovacuum
Previous Message Tom Lane 2003-09-03 21:32:27 Re: Using oids