Problem with indexes - Mailing list pgsql-general

From Przemyslaw Kowalczyk (by way of Przemyslaw Kowalczyk
Subject Problem with indexes
Date
Msg-id E16DpdO-0001gk-00@oak.engine.com.pl
Whole thread Raw
Responses Re: Problem with indexes
List pgsql-general
Hi.

I'm trying to manage apache access logs with Postgresql (7.1). I've parsed
last month access logs for one of our sites into database. There are about
900 000 records. Then I've created index:

stats=# create index log_date on log(date);
CREATE

Then I've tried to select something from the table browsing on date, it
took about 3 minutes to get the result. So I've tried explain:

stats=# explain SELECT ip FROM log WHERE date = 1000733984 ;
NOTICE:  QUERY PLAN:

Seq Scan on log  (cost=0.00..52859.15 rows=9008 width=12)

EXPLAIN
Why is there seq scan, even though I've created index?

Structure of the table
stats=# \d log
                   Table "log"
 Attribute  |          Type           | Modifier
------------+-------------------------+----------
 ip         | character varying(20)   | not null
 date       | bigint                  | not null
 date_human | character varying(50)   |
 request    | character varying(1024) | not null
 response   | character varying(3)    |
 size       | bigint                  | not null
 ref_inner  | character varying(256)  |
 ref_outer  | character varying(1024) |
 browser    | character varying(256)  |
 iduser     | character varying(50)   |
 type       | character varying(1)    |
Indices: log_browser,
         log_date,
         log_iduser,
         log_ip,
         log_ref_inner,
         log_ref_outer,
         log_request,
         log_response,
         log_type

Postgresql runs on linux 2.4.12.

Regards
Przem

pgsql-general by date:

Previous
From: Jan Wieck
Date:
Subject: Re: Weird problem - possibly a bug.
Next
From: "Robert B. Easter"
Date:
Subject: Re: bug or my ignorance ?