From: | Sferacarta Software <sferac(at)bo(dot)nettuno(dot)it> |
---|---|
To: | "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re[2]: [HACKERS] using indexes |
Date: | 1998-10-19 16:12:49 |
Message-ID: | 6758.981019@bo.nettuno.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Tom,
TGL> Jose' wrote:
>>
>> Hello all,
>>
>> I have a table SP with a primary key SNO,
>> I'm trying if v6.4beta2 uses indexes
>> but seems it uses indexes only with '=' operator:
regression=>> explain select unique1 from onek where unique1 < 3;
TGL> NOTICE: QUERY PLAN:
TGL> Index Scan using onek_unique1 on onek (cost=28.67 size=334 width=4)
>> prova=> explain select * from sp where sno = 'S1';
>> NOTICE: QUERY PLAN:
>> Index Scan using sp_pkey on sp (cost=0.00 size=0 width=28)
>> EXPLAIN
TGL> Looks like maybe you need to vacuum to get statistics for the optimizer?
TGL> - Tom
After vacuum the behavior is the same:
prova=> create table onek(unique1 int4 primary key);
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index onek_pkey
for table onek
CREATE
prova=> insert into onek values (1);
INSERT 152858 1
prova=> insert into onek values (10);
INSERT 152859 1
prova=> explain select unique1 from onek where unique1 < 3;
NOTICE: QUERY PLAN:
Seq Scan on onek (cost=0.00 size=0 width=4)
EXPLAIN
prova=> vacuum;
VACUUM
prova=> explain select unique1 from onek where unique1 < 3;
NOTICE: QUERY PLAN:
Seq Scan on onek (cost=1.07 size=1 width=4)
EXPLAIN
PS:
What about:
select unique1 from onek where unique1 = 3 OR unique1 = 1;
^^
does it works on v6.4 ?
Jose'
From | Date | Subject | |
---|---|---|---|
Next Message | Oleg Bartunov | 1998-10-19 17:00:44 | cvs problem ? |
Previous Message | Bruce Momjian | 1998-10-19 15:29:56 | Re: [HACKERS] HAVING bug |