problem with the Index

From: "Jose Antonio Leo" <jaleo8(at)storelandia(dot)com>
To: <pgsql-general(at)postgresql(dot)org>, <pgsql-sql(at)postgresql(dot)org>
Subject: problem with the Index
Date: 2002-10-09 16:56:41
Message-ID: AEEGKNMMPPBJJDLEJDODEEEMCJAA.jaleo8@storelandia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-performance pgsql-sql

I have a problem with the index of 1 table.

I hava a table created :
CREATE TABLE "acucliart" (
"cod_pto" numeric(8,0) NOT NULL,
"cod_cli" varchar(9) NOT NULL,
"mes" numeric(2,0) NOT NULL,
"ano" numeric(4,0) NOT NULL,
"int_art" numeric(5,0) NOT NULL,
"cantidad" numeric(12,2),
"ven_siv_to" numeric(14,2),
"ven_civ_to" numeric(14,2),
"tic_siv_to" numeric(14,2),
"tic_civ_to" numeric(14,2),
"visitas" numeric(2,0),
"ult_vis" date,
"ven_cos" numeric(12,2),
"ven_ofe" numeric(12,2),
"cos_ofe" numeric(12,2),
CONSTRAINT "acucliart_pkey"
PRIMARY KEY ("cod_cli")
);

if i do this select:
explain select * from acucliart where cod_cli=10000;
postgres use the index
NOTICE: QUERY PLAN:
Index Scan using cod_cli_ukey on acucliart (cost=0.00..4.82 rows=1
width=478)

and this select
explain select * from acucliart where cod_cli>10000;
Postgres don't use the index:
NOTICE: QUERY PLAN:
Seq Scan on acucliart (cost=0.00..22.50 rows=333 width=478)

why?

tk

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2002-10-09 17:31:12 Re: [SQL] problem with the Index
Previous Message Markus Gieppner 2002-10-09 16:55:26 High-end PGSQL / Business Intelligence

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2002-10-09 17:11:48 Re: [GENERAL] Point in Time Recovery WAS: Hot Backup
Previous Message Sandeep Chadha 2002-10-09 16:46:18 Re: [GENERAL] Point in Time Recovery WAS: Hot Backup

Browse pgsql-performance by date

  From Date Subject
Next Message Stephan Szabo 2002-10-09 17:31:12 Re: [SQL] problem with the Index
Previous Message Robert Treat 2002-10-09 13:57:18 Re: What does this tell me?

Browse pgsql-sql by date

  From Date Subject
Next Message John Pauley 2002-10-09 17:10:21 SELECT statement never completes.
Previous Message Tom Lane 2002-10-09 13:47:22 Re: Complex SQL query and performance strategy