Lack of use of indexes

Поиск
Список
Период
Сортировка
От Don Isgitt
Тема Lack of use of indexes
Дата
Msg-id 3DDE573A.6030302@soundenergy.com
обсуждение исходный текст
Ответы Re: Lack of use of indexes  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Re: Lack of use of indexes  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hello.

I have a question regarding the lack of use of indexes on a table; I
have included what I hope is all the relevant information. Your help is
appreciated.

Thank you.

Don

gds2=# create index lgtwn on lg (township);
CREATE
gds2=# create index lgrng on lg (range);
CREATE
gds2=# create index lgsec on lg (section);
CREATE
gds2=# create index lgst on lg (state);
CREATE
gds2=# analyze lg;
ANALYZE

gds2=# \d lg
             Table "lg"
  Column  |     Type     | Modifiers
----------+--------------+-----------
 state    | character(2) | not null
 county   | text         | not null
 township | character(5) |
 range    | character(5) |
 section  | integer      |
 meridian | integer      |
 boundary | polygon      |
Indexes: lgrng,
         lgsec,
         lgst,
         lgtwn

gds2=# select count(*) from lg;
 count
--------
 138459
(1 row)

gds2=# explain select * from lg where state='NM';
NOTICE:  QUERY PLAN:

Seq Scan on lg  (cost=0.00..5885.77 rows=14890 width=73)

EXPLAIN

gds2=# explain select * from lg where section=14;
NOTICE:  QUERY PLAN:

Seq Scan on lg  (cost=0.00..5885.77 rows=3836 width=73)

EXPLAIN


gds2=# select state,count(*) from lg group by state;
 state | count
-------+-------
 KS    | 36866
 NM    | 15201
 OA    | 13797
 OK    | 72595
(4 rows)




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

Предыдущее
От: Renê Salomão
Дата:
Сообщение: Re: EXECUTE problems
Следующее
От: Philippe Schmid
Дата:
Сообщение: Readline on MacOS X 10.2.2 and pg 7.3rc1