INDICE CON "like"

From: "Antonio Quintana" <aquintana(at)aguasdeformosa(dot)com(dot)ar>
To: <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: INDICE CON "like"
Date: 2009-07-30 13:18:54
Message-ID: 018801ca1118$9ab52310$1c0101c8@aquintana
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Tengo postgres 8.3.4 sobre debian.
Una tabla de 36.000.000 de registros que es un padron de usuarios.
Con estos indices.
El problema es que cuando hago:
select * from rrjpadron
where nombre="XXX"
entra por el indice que corresponde.

Pero cuando hago
select * from rrjpadron
where nombre like '%XXXX%'
no lo hace por ningun indice.

Que falta hacer?

CREATE TABLE rrjpadron
(
num_doc numeric(8),
tipodoc character varying(4),
sexo character(1),
clase numeric(4),
nombre character varying(20),
direccion character varying(20),
ciudad character varying(17),
localidad character varying(17),
provincia character varying(4),
profesion character varying(10)
)
WITH (OIDS=FALSE);
ALTER TABLE rrjpadron OWNER TO postgres;
GRANT ALL ON TABLE rrjpadron TO postgres;
GRANT ALL ON TABLE rrjpadron TO admins WITH GRANT OPTION;

-- Index: rrjpadron4

-- DROP INDEX rrjpadron4;

CREATE INDEX rrjpadron4
ON rrjpadron
USING btree
(num_doc, lower(nombre::text), lower(sexo::text), lower(provincia::text));

-- Index: rrjpadron5

-- DROP INDEX rrjpadron5;

CREATE INDEX rrjpadron5
ON rrjpadron
USING btree
(lower(nombre::text), lower(sexo::text), lower(provincia::text));

-- Index: rrjpadron6

-- DROP INDEX rrjpadron6;

CREATE INDEX rrjpadron6
ON rrjpadron
USING btree
(nombre, sexo, provincia);

-- Index: rrjpadron7

-- DROP INDEX rrjpadron7;

CREATE INDEX rrjpadron7
ON rrjpadron
USING btree
(num_doc, nombre, sexo, provincia);

Antonio

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Edwin Quijada 2009-07-30 13:46:56 RE: Bajo rendimiento en postgresql cuando se lanza un delete
Previous Message Cesar Erices 2009-07-30 12:54:20 Re: Bajo rendimiento en postgresql cuando se lanza un delete