From: | "Vilson farias" <vilson(dot)farias(at)digitro(dot)com(dot)br> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | <pgsql-general(at)postgresql(dot)org>, "SIMONE Carla MOSENA" <simone(dot)mosena(at)digitro(dot)com(dot)br> |
Subject: | No Luck -> Re: Sequencial scan over primary keys |
Date: | 2000-11-10 17:56:43 |
Message-ID: | 003301c04b3f$961ed600$98a0a8c0@dti.digitro.com.br |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Tom,
I've tried like you said (::integer) but doesn't work. I tried another
way, using GROUP BY at the end, but no luck again. What now?
Table "prog_teste"
Attribute | Type | Modifier
-----------------+--------------+----------
cod_teste | integer | not null
...
Index: xpkprog_teste
Index "xpkprog_teste"
Attribute | Type
-----------+---------
cod_teste | integer
unique btree (primary key)
sitest=# explain select * from prog_teste where cod_teste=90::integer;
NOTICE: QUERY PLAN:
Seq Scan on prog_teste (cost=0.00..1.21 rows=1 width=138)
EXPLAIN
sitest=# explain select * from prog_teste where cod_teste=90::integer order
by cod_teste;
NOTICE: QUERY PLAN:
Sort (cost=1.22..1.22 rows=1 width=138)
-> Seq Scan on prog_teste (cost=0.00..1.21 rows=1 width=138)
Best regards,
José Vilson de Mello de Farias
Dígitro Tecnologia - Brasil
----- Original Message -----
From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vilson farias <vilson(dot)farias(at)digitro(dot)com(dot)br>
Cc: <pgsql-general(at)postgresql(dot)org>; SIMONE Carla MOSENA
<simone(dot)mosena(at)digitro(dot)com(dot)br>
Sent: Sexta-feira, 10 de Novembro de 2000 13:11
Subject: Re: [GENERAL] Sequencial scan over primary keys
: "Vilson farias" <vilson(dot)farias(at)digitro(dot)com(dot)br> writes:
: > sitest=# CREATE TABLE tipo_categoria (
: > sitest(# cod_categoria smallint NOT NULL,
: > sitest(# descricao varchar(40),
: > sitest(# CONSTRAINT XPKtipo_categoria PRIMARY KEY (cod_categoria)
: > sitest(#
: > sitest(# );
:
: > sitest=# explain select * from tipo_categoria where cod_categoria = 1;
: > NOTICE: QUERY PLAN:
:
: > Seq Scan on tipo_categoria (cost=0.00..22.50 rows=10 width=14)
:
: Try it with
: select * from tipo_categoria where cod_categoria = 1::smallint;
:
: An unadorned literal "1" is an int, not a smallint, and the planner is
: not currently very smart about indexing cross-datatype comparisons.
:
: Alternatively, just declare your table with column type int. Because of
: alignment requirements for the varchar column, you're not actually
: saving any space by using the smallint declaration anyway.
:
: regards, tom lane
:
From | Date | Subject | |
---|---|---|---|
Next Message | Will Fitzgerald | 2000-11-10 18:13:23 | 'currency' question; precision/decimal meaing |
Previous Message | Ben Souther | 2000-11-10 16:19:17 | Re: TEXT and BLOBS |