Re: [GENERAL] Table with million rows - and PostgreSQL 9.1 is not using the index

2012-12-05 Thread Edson Richter
Em 05/12/2012 09:59, ERR ORR escreveu: Hi Edson, since you are using 'like' in your select, you may want to try the following (example): CREATE INDEX "MY_LONG_INDEX_NAME_IDX" ON "MY_TABLE_NAME" USING btree ("MY_VARCHAR_FIELD_NAME" COLLATE pg_catalog."default" *varchar_pattern_ops*); (fo

Re: [GENERAL] Table with million rows - and PostgreSQL 9.1 is not using the index

2012-12-05 Thread ERR ORR
Hi Edson, since you are using 'like' in your select, you may want to try the following (example): CREATE INDEX "MY_LONG_INDEX_NAME_IDX" ON "MY_TABLE_NAME" USING btree ("MY_VARCHAR_FIELD_NAME" COLLATE pg_catalog."default" *varchar_pattern_ops *); (for TEXT fields, use *text_pattern_ops* in t

Re: [GENERAL] Table with million rows - and PostgreSQL 9.1 is not using the index

2012-12-04 Thread Alan Hodgson
On Wednesday, December 05, 2012 02:44:39 AM Edson Richter wrote: > Sort (cost=11938.72..11938.74 rows=91 width=93) >Sort Key: t0.nome >-> Nested Loop (cost=0.00..11938.42 rows=91 width=93) > -> Nested Loop (cost=0.00..11935.19 rows=91 width=85) >-> Seq Scan on

Re: [GENERAL] Table with million rows - and PostgreSQL 9.1 is not using the index

2012-12-04 Thread Lonni J Friedman
I'm no expert on this, but it will likely be more helpful to others if you include the table description with all the indices. On Tue, Dec 4, 2012 at 8:44 PM, Edson Richter wrote: > I've a table with >110 rows, with streets. > I'm making a partial search using zip code, and PostgreSQL is igno

[GENERAL] Table with million rows - and PostgreSQL 9.1 is not using the index

2012-12-04 Thread Edson Richter
I've a table with >110 rows, with streets. I'm making a partial search using zip code, and PostgreSQL is ignoring my ZIP index. I'm sure I'm making some mistake, but I can't see where. The query is: SELECT t2.ID, t2.CEP, t2.COMPLEMENTO, t2.NOME, t2.NOMESEMACENTOS, t2.TIPO, t2.BAIRRO_ID