Re: How does Index Scan get used

Поиск
Список
Период
Сортировка
От Oliver Elphick
Тема Re: How does Index Scan get used
Дата
Msg-id 1014401308.13240.2302.camel@linda
обсуждение исходный текст
Ответ на How does Index Scan get used  ("Samuel J. Sutjiono" <ssutjiono@wc-group.com>)
Ответы Re: How does Index Scan get used  (Oliver Elphick <olly@lfix.co.uk>)
Список pgsql-sql
On Fri, 2002-02-22 at 14:46, Samuel J. Sutjiono wrote:
>  
> I tried an Index Scan but I kept on getting Seq Scan. Do you know why ? What do I need to do to get my query to use
indexscan (I tried to turn it on  by doing SET ENABLE_indexscan = on; but it didn't work)
 
> 
> create table test (test_col text);
> create index test_index on test (test_col);
> insert into test values ('abc.xyz');
> insert into test values ('abcxyz');
> insert into test values ('abc/xyz');
> 
> explain select * from test where test_col like 'abc/%';
> 
> NOTICE:  QUERY PLAN:
> 
> Seq Scan on test  (cost=0.00..22.50 rows=10 width=12)

PostgreSQL thinks there are only 10 rows in the table.  Therefore it
will not choose an index scan because for so few rows it is bound to be
more expensive than a sequential scan.

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
    "The LORD bless thee, and keep thee; The LORD make his     face shine upon thee, and be gracious unto thee; The
LORD lift up his countenance upon thee, and give thee      peace."              Numbers 6:24-26 
 



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

Предыдущее
От: "Nick Fankhauser"
Дата:
Сообщение: Re: Page Management
Следующее
От: Fernando Schapachnik
Дата:
Сообщение: Re: [GENERAL] Regular Expression for 'and' instead of 'or'