Re: Re[2]: [HACKERS] using indexes

Поиск
Список
Период
Сортировка
От Marc G. Fournier
Тема Re: Re[2]: [HACKERS] using indexes
Дата
Msg-id Pine.BSF.4.05.9810200725370.4514-100000@hub.org
обсуждение исходный текст
Ответ на Re[2]: [HACKERS] using indexes  (Sferacarta Software <sferac@bo.nettuno.it>)
Список pgsql-hackers
On Mon, 19 Oct 1998, Sferacarta Software wrote:

> 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)
The table has two records in it...why would it use an index?

Marc G. Fournier                               scrappy@hub.org
Systems Administrator @ hub.org                    
scrappy@{postgresql|isc}.org                       ICQ#7615664



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Jose' Soares"
Дата:
Сообщение: Re: [HACKERS] using indexes
Следующее
От: "Marc G. Fournier"
Дата:
Сообщение: anoncvs and remote CVS...