Lack of use of indexes

From: Don Isgitt <djisgitt(at)soundenergy(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Lack of use of indexes
Date: 2002-11-22 16:11:38
Message-ID: 3DDE573A.6030302@soundenergy.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jan Weerts 2002-11-22 16:25:35 Re: help in starting up / shutting down postgres as another user
Previous Message scott.marlowe 2002-11-22 16:06:50 Re: Changing the type of a column in an already populated